1. 程式人生 > >CentOS7整合Mysql資料庫安裝和配置

CentOS7整合Mysql資料庫安裝和配置

一、系統環境

yum update升級以後的系統版本為

[[email protected] yl]# cat /etc/redhat-release 
CentOS Linux release 7.1.1503 (Core) 

二、mysql安裝

一般網上給出的資料都是
[[email protected] yl]# yum install mysql-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.sina.cn
 * extras: mirrors.sina.cn
 * updates: mirrors.sina.cn
No package mysql-server available.
Error: Nothing to do

查資料發現是CentOS 7 版本將MySQL資料庫軟體從預設的程式列表中移除,用mariadb代替了。

有兩種解決辦法:

1、方法一:安裝mariadb
MariaDB資料庫管理系統是MySQL的一個分支,主要由開源社群在維護,採用GPL授權許可。開發這個分支的原因之一是:甲骨文公司收購了MySQL後,有將MySQL閉源的潛在風險,因此社群採用分支的方式來避開這個風險。MariaDB的目的是完全相容MySQL,包括API和命令列,使之能輕鬆成為MySQL的代替品。

安裝mariadb,大小59 M。

[[email protected] yl]# yum install mariadb-server mariadb 
mariadb資料庫的相關命令是:

systemctl start mariadb  #啟動MariaDB

systemctl stop mariadb  #停止MariaDB

systemctl restart mariadb  #重啟MariaDB

systemctl enable mariadb  #設定開機啟動

所以先啟動資料庫

[[email protected] yl]# systemctl start mariadb
然後就可以正常使用mysql了
[[email protected] yl]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; 
or \g. Your MariaDB connection id is 3 Server version: 5.5.41-MariaDB MariaDB Server Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | +--------------------+ 4 rows in set (0.00 sec) MariaDB [(none)]>
安裝mariadb後顯示的也是 MariaDB [(none)]> ,可能看起來有點不習慣。下面是第二種方法。

2、方法二:官網下載安裝mysql-server

# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# rpm -ivh mysql-community-release-el7-5.noarch.rpm
# yum install mysql-community-server
安裝成功後重啟mysql服務。
# service mysqld restart
初次安裝mysql,root賬戶沒有密碼。
[[email protected] yl]# mysql -u root 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.26 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.01 sec)

mysql> 

設定密碼
mysql> set password for 'root'@'localhost' =password('password');
Query OK, 0 rows affected (0.00 sec)

mysql> 

不需要重啟資料庫即可生效。

在mysql安裝過程中如下內容:

複製程式碼
Installed:
  mysql-community-client.x86_64 0:5.6.26-2.el7                mysql-community-devel.x86_64 0:5.6.26-2.el7                
  mysql-community-libs.x86_64 0:5.6.26-2.el7                  mysql-community-server.x86_64 0:5.6.26-2.el7               

Dependency Installed:
  mysql-community-common.x86_64 0:5.6.26-2.el7                                                                            

Replaced:
  mariadb.x86_64 1:5.5.41-2.el7_0          mariadb-devel.x86_64 1:5.5.41-2.el7_0   mariadb-libs.x86_64 1:5.5.41-2.el7_0  
  mariadb-server.x86_64 1:5.5.41-2.el7_0  
所以安裝完以後mariadb自動就被替換了,將不再生效。
[[email protected] yl]# rpm -qa |grep mariadb
[[email protected] yl]#

三、配置mysql

1、編碼

mysql配置檔案為/etc/my.cnf

最後加上編碼配置

[mysql]
default-character-set =utf8
這裡的字元編碼必須和/usr/share/mysql/charsets/Index.xml中一致。

2、遠端連線設定

把在所有資料庫的所有表的所有許可權賦值給位於所有IP地址的root使用者。
mysql> grant all privileges on *.* to [email protected]'%'identified by 'password';
如果是新使用者而不是root,則要先新建使用者
mysql>create user 'username'@'%' identified by 'password';  
此時就可以進行遠端連線了。

相關推薦

CentOS7整合Mysql資料庫安裝配置

一、系統環境 yum update升級以後的系統版本為 [[email protected] yl]# cat /etc/redhat-release CentOS Linux release 7.1.1503 (Core) 二、mysql安裝 一般網

centos7 mysql資料庫安裝配置

2018年11月15日 13:34:55 qq_34731859 閱讀數:5 個人分類: Linux

centos7 mysql資料庫安裝配置 centos7 mysql資料庫安裝配置

centos7 mysql資料庫安裝和配置   一、系統環境 yum update升級以後的系統版本為 [[email protected] yl]# cat /etc/redhat-release CentOS Linux release

centos7 mysql資料庫安裝配置mysql-server安裝失敗)

轉載自: http://www.cnblogs.com/starof/p/4680083.html。 因為自己在用的時候安裝時遇到相同的問題。 centos7 mysql資料庫安裝和配置 一、系統環境 yum update升級以後的

Centos7 mysql資料庫安裝配置 | No package mysql-server available.

一、系統環境yum update升級以後的系統版本為[[email protected] yl]# cat /etc/redhat-release CentOS Linux release 7.1.1503 (Core) 二、mysql安裝一般網上給出的資料都是#

mysql安裝配置

pytho mys nbsp 安裝mysql sta 入學 深入學習 自動 mysq 1.mydql的安裝 重裝wind7系統之後,mysql軟件自動卸載了。現在學習需要使用mysql,還是要安裝mysql。我首先通過下載安裝包的方式安裝,按照教程,但是出現缺

centos7上的postgresql10安裝配置

cli local 新建 repo down 切換 pos emctl rep 安裝數據庫 安裝參考官方文檔:https://www.postgresql.org/download/linux/redhat/ 1.Install the repository RPM: yu

Window10下Mysql安裝配置

隨機密碼 blank 我的電腦 必須 有一個 應該 pre mar for 下載MYSQL 官網下載MYSQL5.7.21版本,鏈接地址https://www.mysql.com/downloads/。下載流程圖如下: 進入官網點擊Community,下載社區版。

Domino整合Portlet開發----安裝配置Domino 6.5伺服器

 Domino整合Portlet開發 企業內的工作流產品較多,例如Domino、BPM等。據我們統計,其中70%以上的企業採用的工作流產品是基於Domino的定製開發或基於Domino衍生產品的定製開發,例如,神州數碼公司、慧點科技公司的工作流產品就是在Domino基礎上二次開發而生成的。本節

Window10下Mysql安裝配置

1.下載安裝包 下面是官網windows系統的mysql下載地址 Mysql下載地址  點進去頁面如下  根據你電腦的系統選擇對應的mysql資料庫下載即可。 下載完畢後點擊下載的msi檔案直接進入安裝步驟     …  後面的就不一一列舉了,什麼都不需要改,一直安裝到

Centos7命令列下安裝配置Apache伺服器

第一步: 首先安裝centos系統,這個比較簡單,只是注意安裝的時候不要最小化安裝,否則系統內容比較少,需要自己重新配置。新手的話建議安裝帶有圖形介面的centos系統,方便自己檢查和驗證,KDE介面做的還是不錯的。 第二步: 安裝Apache服務。Apache在c

centos7.5下mongodb安裝配置

1、下載安裝包 2、解壓 3、移動到指定位置(位置放到你想放的資料夾) mv mongodb-linux-x86_64-rhel70-4.0.4 /opt/mongodb 4、在/opt/mongodb/mongodb下建立資料夾 mkdir -p /dat

MySQL安裝配置(超詳細圖文教程)

資料庫的安裝 1.開啟下載的mysql安裝檔案雙擊解壓縮,執行“mysql-5.5.40-win32.msi”。 2.選擇安裝型別,有“Typical(預設)”、“Complete(完全)”、“Custom(使用者自定義)”三個選項,選擇“Custom”,按“next”鍵繼續

Win7-64位mysql安裝配置

今天在這裡介紹一下Win7-64位系統安裝mysql,我這裡用的是mysql-installer-community-5.7.17.0.msi這個版本的 首先進入mysql官網:http://www

MySQL資料庫安裝常用操作(轉)

檢查Linux系統中是否已經安裝了MySQL,輸入命令嘗試開啟MySQL服務: sudo service mysql start 如果提示是這樣的,則說明系統中沒有 MySQL,需要繼續安裝: mysql: unrecognized service 在Ubuntu上安裝MySQL,最

MySQL資料庫安裝配置雞湯

目錄 一、概述 二、MySQL安裝 三、安裝成功驗證 四、NavicatforMySQL下載及使用   一、概述   MySQL版本:5.7.17   下載地址:http://rj.baidu.com/soft/detail/12585.html?ald   客戶端工具:Nav

Linux-mysql伺服器安裝配置

Linux 安裝mysql服務一 、yum安裝       1、檢視yum倉庫中可以安裝的mysql-server:       yum list | grep mysql       2、安裝mysq

Centos7下的github安裝配置以及使用

一、安裝gityum install git二、生成ssh金鑰ssh-keygen -t rsa -C "your email address"接下來的操作都是回車,直到得到id_rsa和id_rsa.pub檔案,然後cd /root/.ssh,發現裡面有這兩個檔案即為成功,

9、Linux下mysql資料庫安裝配置實操

1、安裝 sudo yum -y install mysql-server 2、 sudo vim /etc/my.cnf 將字符集設定成UTF-8 3、將mysql設定為隨系統啟動 sudo chkconfig mysqld on sudo chkco

Jenkins+maven+SVN+Tomcat持續整合釋出環境安裝配置

        Jenkins是基於Java開發的一種持續整合 Jenkins安裝檔案下載  目前最新的版本是2.46.1版本 把Jenkins 2.46.1版解壓後,有兩種執行方式:    1. 執行 java -jar jenkins.war,採用內建jett