1485
MySQLERRORNotableData TypesHIGH confidence

Data too long for column type

Production Risk

Low — the insert/update fails; check data length against column definition.

What this means

ER_DATA_TOO_LONG_FOR_TYPE (1485, SQLSTATE 22001) is raised when a value being inserted or updated exceeds the maximum length of the target column data type.

Why it happens
  1. 1Inserting a string longer than the column VARCHAR or CHAR length
  2. 2Inserting a numeric value outside the range of the column type
How to reproduce
trigger — this will error
trigger — this will error
CREATE TABLE t (name VARCHAR(10));
INSERT INTO t VALUES ('This is too long');  -- 16 chars in a 10-char column

expected output

ERROR 1485 (22001): Data too long for type

Fix

Increase column size or truncate the data

Increase column size or truncate the data
-- Increase column size:
ALTER TABLE t MODIFY name VARCHAR(255);

-- Or truncate on insert:
INSERT INTO t VALUES (LEFT('This is too long', 10));

Why this works

Ensuring the data fits within the column definition prevents truncation errors.

Sources
Official documentation ↗

MySQL 8.0 — 1485 ER_DATA_TOO_LONG_FOR_TYPE

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MySQL errors