Question: ERROR 1366 (HY000): String value in here Incorrect: ' \ XC4 \ XEA \ XBC \ XB6 ' for column ' xxx ' AT Row 1 is inserted in DOS or query Chinese garbled
Sign mysql, enter the command: show variables like '% char%';
得到: +--------------------------+--------------------------+ | Variable_name | Value | +--------------------------+--------------------------+ | character_set_client utf8 | character_set_connection utf8 | character_set_database latin1 | character_set_filesystem binary | character_set_results utf8 | character_set_server utf8 | character_set_system utf8 | character_sets_dir G:\mysql\share\charsets\ +--------------------------+--------------------------+
If this happens you need to change the database code: alter database database name of the charset utf8;
再用命令: show variables like '%char%'; +--------------------------+--------------------------+ | Variable_name | Value | +--------------------------+--------------------------+ | character_set_client utf8 | character_set_connection utf8 | character_set_database utf8 -- 主要变更了这行 | character_set_filesystem binary | character_set_results utf8 | character_set_server utf8 | character_set_system utf8 | character_sets_dir G:\mysql\share\charsets\ +--------------------------+--------------------------+
Although the code has been consistent, but any input Chinese course will complain
At this time, you need to enter the command: set character_set_client = gbk; set receives the inserted code is GBK, so that you can insert Chinese
set character_set_results = gbk; set output encoding is GBK
After re-insert the DOS and queries Chinese will not be garbled!
However, this is only a one-time, when the database connection is disconnected prior to reappear again, you have to re-set.