1 修改/etc/mysql/my.cnf配置文件 增加default-character-set=utf8
配置文件如下
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
default-character-set=utf8
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci
2 重启mysql
[root@winner ~]#service mysql restart