Skip to content
Home » MySQL » How to Resolve ERROR 1366 (HY000): Incorrect string value

How to Resolve ERROR 1366 (HY000): Incorrect string value

ERROR 1366 (HY000)

Let's see how will this error happen:

mysql> update zh_table set zh_name = '𤨒' where id = 35620;
ERROR 1366 (HY000): Incorrect string value: 'xF0xA4xA8x92...' for column 'zh_name' at row 1

In the above statement, we were trying to set a column value with a 4-byte character, but it failed with ERROR 1366.

Since the table is based on UTF8 that can only store up to 3-byte characters, not 4-byte, so we should convert the table to UTF8MB4 in order to save 4-byte characters.

Please refer to the following post for further information about how to convert UTF8 to UTF8MB4 in a database. How to Convert an Entire Database From UTF8 to UTF8MB4.

Leave a Reply

Your email address will not be published. Required fields are marked *