修改 /etc/mysql/my.cnf

[client]
default-character-set=utf8

[mysqld]
character_set_server=utf8

[mysql]
default-character-set=utf8

然后 sudo service mysql restart