查看mysql 字符集设置情况:
show variables like '%char%'
+--------------------------+----------------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------------+
| character_set_client | gbk |
| character_set_connection | gbk |
| character_set_database | gbk |
| character_set_filesystem | binary |
| character_set_results | gbk |
| character_set_server | gbk |
| character_set_system | utf8 |
| /usr/local/mysql/share/mysql/charsets/ |
+--------------------------+----------------------------------------+
修改变量的编码
set character_set_server='utf8';