卸載和刪除都使用過了,沒有起到效果,而後用了以下的方案,進行解決:mysql
CentOS 從 Yum 源安裝配置 Mariadb
2017.03.01 WangYan 學習筆記 熱度 7℃ sql
1、安裝 MariaDB
1.添加 MariaDB Yum 源
cat >/etc/yum.repos.d/MariaDB.repo<<'EOF'數據庫
[mariadb]centos
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-MariaDBurl
gpgcheck=1centos7
EOFspa
2.安裝 MariaDB
sudo yum install -y MariaDB-server MariaDB-clientserver
3.啓動 MariaDB
sudo systemctl start mariadb
sudo systemctl enable mariadb
2、設置 MariaDB
mysql_secure_installation
- 初始密碼爲空,直接回車。
- 設置 root 密碼
- 是否移除匿名用戶
- 是否禁止 root 遠程登陸
- 是否刪除 ‘test’ 測試數據庫
3、測試 MariaDB
mysqladmin -u root -p version
4、解決 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%';