配置默认编码为utf8
改/etc/my.cnf配置文件,在[mysqld]下添加编码配置,如下所示:
[mysqld] character_set_server=utf8 init_connect='SET NAMES utf8'
重新启动mysql服务
systemctl restart mysqld