先备份一下MySQL的配置文件:
sudo cp /etc/mysql/my.cnf /etc/mysql/my.cnf.old
编辑my.cnf
sudo gedit /etc/mysql/my.cnf
找到[mysql]段,并加入
# 设置默认的字符集UTF-8:
character-set-server=utf8
collation-server=utf8_general_ci
default-character-set=utf8
保存后重启MySQL:
sudo /etc/init.d/mysql restart
sudo cp /etc/mysql/my.cnf /etc/mysql/my.cnf.old
编辑my.cnf
sudo gedit /etc/mysql/my.cnf
找到[mysql]段,并加入
# 设置默认的字符集UTF-8:
character-set-server=utf8
collation-server=utf8_general_ci
default-character-set=utf8
保存后重启MySQL:
sudo /etc/init.d/mysql restart
关键字词: