MySQL: 1366 error solution

When inserting Chinese data into the MySQL database today, the following error is sent:

Error Code: 1366. Incorrect string value: '\xE9\x80\x8D\xE9\x81\xA5...' for column 'user_name' at row 1 0.000 sec

I found a solution on the Internet to change the character set of the database configuration file my.ini to utf8:

default-character-set=utf8 (the original was default-character-set=latin1 )

Then restart the MySQL service, and find that the above error is still reported. Later, I thought about whether to delete the user_name field and rebuild it, because the user_name field is created under the latin1 character set. After deleting and rebuilding the field, it really works.

Record the above method for your reference~

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325076176&siteId=291194637