如何解決centos mariadb 亂碼問題

centos mariadb亂碼的解決辦法:1、在[mysqld]標簽下添加“character-set-server=utf8”;2、在[client]標簽下添加“default-character-set=utf8”;3、重啟服務即可。

如何解決centos mariadb 亂碼問題

本文操作環境:CentOS 7系統、Dell G3電腦。

如何解決centos mariadb 亂碼問題?

CentOS 7 配置MariaDB(MySQL)字符編碼,防止中文亂碼

[root@localhost~]#?vi?/etc/my.cnf??(如果不行則sudo?vi?/etc/my.cnf) #在[mysqld]標簽下添加 character-set-server=utf8 [root@localhost~]#?vi?/etc/my.cnf.d/client.cnf #在[client]標簽下添加 default-character-set=utf8

重啟

[root@localhost~]#?systemctl?restart?mariadb mysql?-u?root?-p?后查看現在的字符編碼 show?variables?like?'%character%';

推薦教程:《centos教程

以上就是如何解決

? 版權聲明
THE END
喜歡就支持一下吧
點贊14 分享