Find some interesting answers when checking for the wrong reason for MySQL 1366.
However, someone has given a better solution.
- The MySQL 1366 error is roughly described below
- 1. SQL Error:1366:incorrect String value: "\xe8\xaf\xa6\xe7\xbb\x86 ..." for column ' address ' at row 1
- Workaround: Check the database the character set of this field is the same as the character set of the SQL statement passing data, and a MySQL1366 error is thrown.
- Modify the character set and collation rules for this field in MySQL. Assuming the data table is Phplamp, the character set of the SQL statement is UTF8 and the error field is address:
- MySQL 1366 Error Resolution
- 1. #检查数据表所有字段的状态
- 2.->show full columns from Phplamp;
- 3. #发现address字段的Collation项非utf8, modify it!
- 4.->alter table phplamp change name name varchar (+) Character Set UTF8 collate utf8_unicode_ci NOT NULL default ‘‘;
- Once you have modified the character set for the field, you can use the show full columns from table_name command to check again to ensure that it is foolproof. If your SQL character set is GBK or GB2312 or otherwise, you only need to change the character set of the table field to its corresponding encoding.
- To send another MySQL command:
- Modify the character set and collation of a data table
The reason for the error in checking MySQL 1366