1、查看mysql字符编码
show variables like '%char%';
show variables like '%coll%';
2、修改/etc/my.cnf配置
[mysqld]
character-set-server=utf8
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
3、重启mysql,然后查看编码
4、修改数据库和表的字符编码
alter database mydb character set UTF8;
show create table tb_user;
alter table tb_user convert to character set UTF8;