centos yum 安装 mariadb

1. 在 /etc/yum.repos.d/ 下建立 MariaDB.repo,输入内容

[mariadb]
name=MariaDB
baseurl=http://yum.mariadb.org/10.1.10/centos6-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

如需其他版本, 到 http://yum.mariadb.org/ 查看

2. 执行安装

yum -y install MariaDB-client MariaDB-server

3. 启动 mysql 服务

service mysql start

4. 修改root密码

mysqladmin -u root password '111111'

5. 配置 MariaDB

$ sudo /usr/bin/mysql_secure_installation
[...]
Enter current password for root (enter for none):
OK, successfully used password, moving on...
[...]
Set root password? [Y/n] y
New password:
Re-enter new password:
Remove anonymous users? [Y/n] Y
[...]
Disallow root login remotely? [Y/n] N
[...]
Remove test database and access to it [Y/n] Y
[...]
Reload privilege tables now? [Y/n] Y
All done!

6. 登录

mysql -u root -p