MySQLMySQL 1406
MySQL 1406: Data Too Long for Column
MySQL 1406 is raised in strict mode when the data being inserted or updated exceeds the maximum length defined for the target column. The operation is aborted.
Example Query
CREATE TABLE products (name VARCHAR(10));
INSERT INTO products (name) VALUES ('This name is too long');Common Causes
- 1VARCHAR or CHAR column size is too small for the actual data
- 2Multi-byte UTF-8 characters counting as multiple bytes in older column definitions
- 3Application change that extended a field without a corresponding schema migration
How to Fix It
Increase the column size with ALTER TABLE t MODIFY COLUMN name VARCHAR(255). Validate and truncate input on the application side before inserting. Check the character set — utf8mb4 uses up to 4 bytes per character.
Need a reliable database?
Try Supabase — free PostgreSQL with a generous free tier. No credit card required.
Got a query causing this error?
Paste it into SQLbuddy and get an instant plain-English explanation with optimization tips.
Analyze My Query →