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/下直接创建仓库文件
:cat /etc/yum.repos.d/Mariadb.repo
#内容如下
# MariaDB 10.1 CentOS repository list - created -- : 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=
:Centos的仓库文件内容如下:
# MariaDB 10.1 CentOS repository list - created -- : 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=
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