卸载和删除都使用过了,没有起到效果,然后用了如下的方案,进行解决:
CentOS 从 Yum 源安装配置 Mariadb
2017.03.01 WangYan 学习笔记 热度 7℃
一、安装 MariaDB
1.添加 MariaDB Yum 源
cat >/etc/yum.repos.d/MariaDB.repo<<‘EOF‘
[mariadb]
name = MariaDB
baseurl = http://mirrors.ustc.edu.cn/mariadb/yum/10.2/centos7-amd64/
gpgkey= http://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF
2.安装 MariaDB
sudo yum install -y MariaDB-server MariaDB-client
3.启动 MariaDB
sudo systemctl start mariadb
sudo systemctl enable mariadb
二、设置 MariaDB
mysql_secure_installation
- 初始密码为空,直接回车。
- 设置 root 密码
- 是否移除匿名用户
- 是否禁止 root 远程登录
- 是否删除 ‘test’ 测试数据库
三、测试 MariaDB
mysqladmin -u root -p version
四、解决 MariaDB 中文乱码
https://mariadb.com/kb/en/mariadb/setting-character-sets-and-collations/
[client]
...
default-character-set=utf8
...
[mysql]
...
default-character-set=utf8
...
[mysqld]
...
character-set-server = utf8
collation-server = utf8_general_ci
character_set_server = utf8
collation_server = utf8_general_ci
...
测试
mysql -u root -p
SHOW VARIABLES WHERE Variable_name LIKE ‘character\_set\_%‘ OR Variable_name LIKE ‘collation%‘;