centos mariadb亂碼的解決辦法:1、在[mysqld]標(biāo)簽下添加“character-set-server=utf8”;2、在[client]標(biāo)簽下添加“default-character-set=utf8”;3、重啟服務(wù)即可。
本文操作環(huán)境:CentOS 7系統(tǒng)、Dell G3電腦。
如何解決centos mariadb 亂碼問(wèn)題?
CentOS 7 配置MariaDB(MySQL)字符編碼,防止中文亂碼
[root@localhost~]# vi /etc/my.cnf (如果不行則sudo vi /etc/my.cnf) #在[mysqld]標(biāo)簽下添加 character-set-server=utf8 [root@localhost~]# vi /etc/my.cnf.d/client.cnf #在[client]標(biāo)簽下添加 default-character-set=utf8
重啟
[root@localhost~]# systemctl restart mariadb mysql -u root -p 后查看現(xiàn)在的字符編碼 show variables like '%character%';
推薦教程:《centos教程》