/etc/my.cnf
[client]
default-character-set = utf8
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysql]
default-character-set = utf8
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
init_connect='SET NAMES utf8'
character_set_server = utf8
-------------------------------------------------------------------------------
centeros
/etc/init.d/mysqld restart
mysql -u root -p -S /var/lib/mysql/mysql.sock
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.00 sec)
http://blog.sina.com.cn/s/blog_8a3a624901018j83.html