CentOS版本:CentOS-7-x86_64-Minimal-1511
1、安装Mariadb
[root@localhost~]# yum -y install mariadb-server
2、启动服务并设置开机启动
[root@localhost~]# systemctl start mariadb [root@localhost~]# systemctl enable mariadb
3、配置MariaDB
[root@localhost~]# MysqL_secure_installation
#输入当前root密码
Entercurrent password for root (enter for none):
#设置root密码?
Changethe root password?[Y/n]
Removeanonymous users?[Y/n]
Disallowroot login remotely?[Y/n]
Removetest database and access to it? [Y/n]
#重新加载权限表?
Reloadprivilege tables now? [Y/n]
4、配置MariaDB字符编码(以utf8mb4为例)
[root@localhost~]# vi /etc/my.cnf #在[MysqLd]标签下添加 character-set-server=utf8mb4 [root@localhost~]# vi /etc/my.cnf.d/client.cnf #在[client]标签下添加 default-character-set=utf8mb4
5、重启启动MariaDB服务
[root@localhost~]# systemctl restart mariadb
6、查看MariaDB字符编码
MariaDB[(none)]show variables like ‘%character%’;
7、卸载MariaDB数据库
[root@localhost~]# rpm -aq|grep mariadb mariadb-libs-5.5.50-1.e17_2.x86_64 mariadb-5.5.50-1.e17_2.x86_64 mariadb-server-5.5.50-1.e17_2.x86_64 [root@localhost~]# yum -y remove mariadb*