一.设置配置文件修改mysql的默认编码
查看编码:
mysql> show variables like ‘%character%‘;
(1)关闭mysql服务
service mysql stop
(2)修改 /etc/mysql/my.cnf (默认的安装路径)
vim /etc/mysql/my.cnf
打开my.cnf后,在文件内的[mysqld]下增加如下两行设置:
character_set_server=utf8
init_connect=‘SET NAMES utf8‘
时间: 2024-10-06 06:05:42