1. 程式人生 > >mysql source匯入報錯ERROR 1366

mysql source匯入報錯ERROR 1366

檔案是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;