查看数据库编码如下:
MysqL> show variables like '%char%';
+--------------------------+----------------------------------+
| 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 | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/MysqL/share/charsets/ |
+--------------------------+----------------------------------+
8 rows in set
其中:
character_set_server | latin1
解决方法:
修改编码为uft8;
set @@character_set_server='utf8';