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
1 添加 2 [mysqld] 3 character_set_server = utf8 4 5 [mysql] 6 default-character-set = utf8 7 8 [client] 9 default-character-set = utf8
重启mysql,输入
show variables like '%char%';