CentOS yum 安装、卸载MariaDB数据库

前端之家收集整理的这篇文章主要介绍了CentOS yum 安装、卸载MariaDB数据库前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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]

#禁止root用户远程登录

Disallowroot login remotely?[Y/n]

#删除test数据库

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*

猜你在找的CentOS相关文章