CentOS yum 安装、卸载MariaDB数据库

来源:互联网 发布:underscore min.js 编辑:程序博客网 时间:2024/04/29 18:58

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 mariadbmariadb-libs-5.5.50-1.e17_2.x86_64mariadb-5.5.50-1.e17_2.x86_64mariadb-server-5.5.50-1.e17_2.x86_64[root@localhost~]# yum -y remove mariadb*



0 0
原创粉丝点击