1366: Incorrect string/integer value for column
MySQLWhat does it mean?
A value incompatible with the column's type or character set was inserted into a column. Usually caused by a character encoding or type mismatch.
Why does it happen?
Writing a 4-byte emoji/character (utf8mb4) into a latin1 column, entering non-numeric text into a numeric column, a wrong connection charset, or sending a value of a different type than expected.
How to fix it
For character issues, convert the column/table to utf8mb4: ALTER TABLE my_table CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci and set the connection charset to utf8mb4. Validate types in the application for numeric fields. Remember that the server runs in strict SQL mode (STRICT); the root cause is the type/encoding of the data.
More from this engine
- 1215Cannot add foreign key constraint
- 1451Cannot delete or update a parent row: a foreign key constraint fails
- 1452Cannot add or update a child row: a foreign key constraint fails
- 1044Access denied for user to database
- 1264Out of range value for column
- 1052Column 'x' in field list is ambiguous
- 1136Column count doesn't match value count