环境 CentOS 7
mysql 5.7
设置编码为utf8,才能支持中文
mysql -u *** -p 登上数据库
执行
show variables like '%char%';
显示mysql编码如下:
character_set_client utf8
character_set_connection utf8
character_set_database latin1
character_set_filesystem binary
character_set_results utf8
character_set_server latin1
character_set_system utf8
设置方法:
vim /etc/my.cnf
[mysqld] 下加上
character_set_server = utf8
[mysqld_safe]下加上
default-character-set = utf8