发现自己重装过的xubuntu一无所有,所以先配置Mysql
sudo vim /etc/mysql/my.cnf

[client]
port= 3306
socket = /var/run/mysqld/mysqld.sock
default-character-set=utf8 #utf8
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
......
[mysqld]
#
# * Basic Settings
#
default-character-set=utf8
init_connect='SET NAMES utf8'

这之后若只是重启mysql的服务,会发现server的默认语言仍然是latin,但是重启后就可以得到

mysql> show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.01 sec)