文件是utf8的,数据库表是utf8的,但是source 导入文件会报错 1366 。直接复制粘贴就没有问题。
可能是因为客户端是gbk
SHOW VARIABLES LIKE 'character%';
+--------------------------+---------
-----+
| Variable_name | Value
|
+--------------------------+---------
-----+
| character_set_client | gbk
|
| character_set_connection | gbk
|
| character_set_database | utf8
|
| character_set_filesystem | binary
|
| character_set_results | gbk
|
| character_set_server | utf8
|
| character_set_system | utf8
|
改为utf8后正常
set character_set_client=utf8;