先要登录mysql服务器看看是什么编码的:
mysql
show variables like ‘character%’;
会出现下面的数据
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
从以上信息可知数据库的编码为latin1;
其中,character_set_client为客户端编码方式;character_set_connection为建立连接使用的编码;character_set_database数据库的编码;
character_set_results结果集的编码;
character_set_server数据库服务器的编码;
直接修改sqlyog的编码格式就好了
SET NAMES ‘latin1’ ;
创建数据库是设定编码格式:
CREATE DATABASE `ssp` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;