CentOS 7 安裝 MariaDB 10.1
使用默認的
yum install mariadb-server
時膳犹,默認安裝的是和Mysql相兼容的5.5版本。想安裝Mariadb 10.1或以上版本铃在,必須先指定yum源。
-
使用源配置向導
可以選擇合適的操作系統(tǒng)和想要安裝的MariaDB版本,然后自動生成源配置定铜。
-
我使用的是:
# MariaDB 10.1 CentOS repository list - created 2016-05-12 09:28 UTC # http://mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.1/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
-
配置yum源
/etc/yum.repos.d/
touch MariaDB.repo
vim MariaDB.repo將上面的內容復制進去阳液,保存退出。
-
安裝MariaDB 10.1
yum install MariaDB-server MariaDB-client
如果出現(xiàn)了
MariaDB can’t be installed because of conflict with mariadb-libs-xxxx
宿稀,則需要先卸載當前安裝的版本:yum remove mariadb-libs*
安裝完成后趁舀,會提示你為root設置密碼,此時需要先運行Mariadb祝沸。
-
運行 MariaDB
service mysql start
輸出:
Starting mysql (via systemctl): [ OK ]
-
配置 MariaDB
mysql_secure_installation
如果出現(xiàn)
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 "No such file or directory")'
,則說明mariadb沒有啟動矮烹,需要先運行Mariadb,參考第5步罩锐。Enter current password for root (enter for none): 輸入當前的root密碼(默認空)奉狈,直接回車 Set root password? [Y/n] 設置新密碼,y Remove anonymous users? [Y/n] 移除匿名用戶涩惑,y Disallow root login remotely? [Y/n] 禁止root用戶遠程登錄仁期,y Remove test database and access to it? [Y/n] 移除測試數(shù)據(jù)庫,y Reload privilege tables now? [Y/n] y
-
配置
Mysql在Linux上默認是表名大小寫敏感的竭恬,需要手動配置才能使之忽略大小寫:vim vim /etc/my.cnf
在
[mysqld]
下跛蛋,修改(沒有則添加):lower_case_table_names=1
然后重啟mysql服務
service mysql restart
- 大功告成!
參考資料: