详细解释参考:mysql
注意点:表格也是有字符集的,没指定默认用数据库的,数据库建立时没指定默认是用系统的。数据库
而系统的字符集在配置文件是能够设置的。segmentfault
ps:修改表格字符集的命令:socket
alter table xxx convert to character set utf8;code
my.cnf 设置:server
[client]ci
port = 3306unicode
socket = /var/run/mysqld/mysqld.sockget
default-character-set=utf8
[mysqld]
#
# * Basic Settings
#
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
default-character-set=utf8
[mysql]
default-character-set=utf8