1.首先中止MySQL服務:sudo /etc/init.d/mysql stop
2.而後編輯MySQL配置文件:sudo gedit /etc/mysql/my.cnf
在my.cnf文件中的[client]段下面加入
default-character-set=utf8
[mysqld_safe]
default-character-set=utf8
[mysqld]
default-character-set=utf8
[mysql]
default-character-set=utf8
從新啓動MySQL服務,
sudo /etc/init.d/mysql startmysql