1:由於centos7 默認使用yum安裝MySQL的話就會安裝mariadb,只是安裝的版本停留在mariadb5.x,版本比較低。如果我們需要安裝mariadb10這里就需要刪除mariadb-libs-5.5.52-1.el7.x86_64,這是系統默認安裝的。
rpm -qa mariadb-libs yum remove mariadb-libs
2:配置mariadb的yum倉庫,這里我們選擇在/etc/yum.repos.d/下直接創建倉庫文件
1:cat /etc/yum.repos.d/Mariadb.repo #內容如下 # MariaDB 10.1 CentOS repository list - created 2017-02-23 08:53 UTC # http://downloads.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 2:Centos的倉庫文件內容如下: # MariaDB 10.1 CentOS repository list - created 2017-02-23 08:54 UTC # http://downloads.mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.1/centos6-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
3:使用yum安裝
yum install mariadb-server mariadb-devel
4:安裝成功以后會有以下提示:
PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER ! To do so, start the server, then issue the following commands: '/usr/bin/mysqladmin' -u root password 'new-password' '/usr/bin/mysqladmin' -u root -h node1.zdvall.com password 'new-password' Alternatively you can run: '/usr/bin/mysql_secure_installation'
這里提示我們需要為root用戶設置密碼以及進行初始化
5:設置密碼以及完成初始化
/usr/bin/mysql_secure_installation
接下來按照提示為root設置密碼,刪除匿名用戶,刪除test數據庫,然后刷新權限!此時就可以使用新密碼登錄了。
關於MySQL的常用基本命令可參照http://www.cnblogs.com/skymyyang/p/7144670.html