mysql查看编码
show variables like '%char%';
找到my.cnf
find / -iname '*.cnf' -print
-
关闭mysql,找到 /etc/my.cnf 文件
1.1 如果没有找到my.cnf文件,就从 /usr/share/mysql/ 中将 my-meduim.cnf 复制到 /etc/ 下并重命名为 my.cnf;
指令:cp/usr/share/mysql/my-medium.cnf /etc/my.cnf。
1.2 如果在/etc下存在 my.cnf 文件,直接进行下一步。 -
编辑 /etc/my.cnf 文件
指令:vim /etc/my.cnf
,在 [mysqld] 下面添加一行代码character_set_server= utf8
-
重启mysql服务:
service mysql stop;
service mysql status;
service mysql start;