show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
+--------------------------+----------------------------+
默认MYSQL的编码如图所示,需要修改默认编码可以修改my.ini文件,linux下my.cnf
添加
[mysqld]
character_set_server = utf8 [mysql]
default-character-set = utf8 [client]
default-character-set = utf8
重启mysql,输入
show variables like '%char%';