> CentOS > CentOS故障 >

centos7.0触发器乱码的解决

[root@iZ62jhlmmZ ~]# uname -a
Linux iZ62jhlmsymZ 3.10.0-123.13.2.el7.x86_64 #1 SMP Thu Dec 18 14:09:13 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@iZ62jhlmmZ ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 5.5.41-MariaDB MariaDB Server

修改配置文件

[root@iZ62jhlmmZ ~]# vi /etc/my.cnf.d/server.cnf


在 [mysqld] 下添加
character-set-server = utf8
character-set-filesystem = utf8

保存退出

[root@iZ62jhlmsymZ ~]# service mariadb restart

在 mysql 中

SHOW VARIABLES LIKE 'character_set_%';
SHOW VARIABLES LIKE 'collation_%';

检查结果是否正确

 参考资料:

mysql命令行修改字符编码 


(责任编辑:IT)