MySQL 8.4Lab-verified · 2026-12-01

MySQL ERROR 1265 (01000): Data truncated for column

The value does not fit the column type (an ENUM value that is not in the list, or text in a numeric column), and strict mode turns the truncation into an error.

MySQL 8.4.13
1265 (01000): Data truncated for column 'status' at row 1

Jump to a cause

  1. 01Inserting a value that is not in the ENUM list
  2. 02ALTER TABLE removes an ENUM value that rows still use
  3. 03Number with unit text (like '5 EA') into an INT column
  4. 04ALTER shrinking a VARCHAR while longer values exist

Lab-verifiedReproduced and fixed on MySQL 8.4.13 · 2026-12-01 · container image mysql:8.4

The message names the column and the row: Data truncated for column 'status' at row 2. With INSERT … SELECT, a multi-row INSERT or ALTER TABLE … MODIFY, the row number points to the bad row.

MySQL 8.4's default sql_mode includes STRICT_TRANS_TABLES, so the statement fails instead of storing a cut-down value with a warning. With Japanese lc_messages the message is translated; with Korean it stays in English.

01Inserting a value that is not in the ENUM list

status is ENUM('NEW', 'PAID'). A new status 'SHIPPED' from the application is not in the list, so the INSERT fails at row 1.

Setup
Setuprun as lab_a
CREATE TABLE orders (id INT PRIMARY KEY, status ENUM('NEW', 'PAID'));
OUTPUT
Query OK, 0 rows affected (0.02 sec)
Reproducerun as lab_a
INSERT INTO orders VALUES (1, 'SHIPPED');
✕ ERROR
ERROR 1265 (01000): Data truncated for column 'status' at row 1
Fixrun as lab_a
ALTER TABLE orders MODIFY status ENUM('NEW', 'PAID', 'SHIPPED');
OUTPUT
Query OK, 0 rows affected (0.00 sec)
Records: 0  Duplicates: 0  Warnings: 0

Add the value to the ENUM with ALTER TABLE … MODIFY status ENUM('NEW', 'PAID', 'SHIPPED'). The same INSERT then works.

After the fixrun as lab_a
INSERT INTO orders VALUES (1, 'SHIPPED');
SELECT * FROM orders;
✓ SUCCESS
Query OK, 1 row affected (0.01 sec)

+----+---------+
| id | status  |
+----+---------+
|  1 | SHIPPED |
+----+---------+
1 row in set (0.00 sec)

02ALTER TABLE removes an ENUM value that rows still use

The column is changed from ENUM('NEW', 'PAID', 'HOLD') to ENUM('NEW', 'PAID'), but row 2 still holds 'HOLD'. The ALTER fails at row 2 and the table is not changed.

Setup
Setuprun as lab_a
CREATE TABLE orders (id INT PRIMARY KEY, status ENUM('NEW', 'PAID', 'HOLD'));
INSERT INTO orders VALUES (1, 'NEW'), (2, 'HOLD'), (3, 'PAID');
OUTPUT
Query OK, 0 rows affected (0.01 sec)

Query OK, 3 rows affected (0.01 sec)
Records: 3  Duplicates: 0  Warnings: 0
Reproducerun as lab_a
ALTER TABLE orders MODIFY status ENUM('NEW', 'PAID');
✕ ERROR
ERROR 1265 (01000): Data truncated for column 'status' at row 2
Checkrun as lab_a
SELECT status, COUNT(*) FROM orders GROUP BY status;
OUTPUT
+--------+----------+
| status | COUNT(*) |
+--------+----------+
| NEW    |        1 |
| HOLD   |        1 |
| PAID   |        1 |
+--------+----------+
3 rows in set (0.00 sec)
Fixrun as lab_a
UPDATE orders SET status = 'NEW' WHERE status = 'HOLD';
OUTPUT
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

First check which values are in use with GROUP BY status, move 'HOLD' rows to another value, then run the ALTER again. All 3 rows are kept.

After the fixrun as lab_a
ALTER TABLE orders MODIFY status ENUM('NEW', 'PAID');
SELECT * FROM orders ORDER BY id;
✓ SUCCESS
Query OK, 3 rows affected (0.04 sec)
Records: 3  Duplicates: 0  Warnings: 0

+----+--------+
| id | status |
+----+--------+
|  1 | NEW    |
|  2 | NEW    |
|  3 | PAID   |
+----+--------+
3 rows in set (0.00 sec)

03Number with unit text (like '5 EA') into an INT column

An upload table stores quantities as text. Row 2 has '5 EA', which is not a pure number, so INSERT … SELECT into the INT column fails at row 2.

Setup
Setuprun as lab_a
CREATE TABLE stock (item VARCHAR(10) PRIMARY KEY, qty INT);
CREATE TABLE stock_upload (item VARCHAR(10), qty VARCHAR(20));
INSERT INTO stock_upload VALUES ('A100', '12'), ('B200', '5 EA');
OUTPUT
Query OK, 0 rows affected (0.02 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0
Reproducerun as lab_a
INSERT INTO stock SELECT item, qty FROM stock_upload;
✕ ERROR
ERROR 1265 (01000): Data truncated for column 'qty' at row 2
Checkrun as lab_a
SELECT item, qty FROM stock_upload WHERE qty NOT REGEXP '^[0-9]+$';
OUTPUT
+------+------+
| item | qty  |
+------+------+
| B200 | 5 EA |
+------+------+
1 row in set (0.00 sec)

Find the bad rows with qty NOT REGEXP '^[0-9]+$', then strip non-digits: CAST(REGEXP_REPLACE(qty, '[^0-9]', '') AS UNSIGNED). B200 is stored as 5.

After the fixrun as lab_a
INSERT INTO stock SELECT item, CAST(REGEXP_REPLACE(qty, '[^0-9]', '') AS UNSIGNED) FROM stock_upload;
SELECT * FROM stock ORDER BY item;
✓ SUCCESS
Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0

+------+------+
| item | qty  |
+------+------+
| A100 |   12 |
| B200 |    5 |
+------+------+
2 rows in set (0.00 sec)

04ALTER shrinking a VARCHAR while longer values exist

Shrinking name from VARCHAR(50) to VARCHAR(10) fails at row 2, because 'Alexandria Johnson' is 18 characters. The whole ALTER is rolled back, so the column stays VARCHAR(50).

Setup
Setuprun as lab_a
CREATE TABLE customers (id INT PRIMARY KEY, name VARCHAR(50));
INSERT INTO customers VALUES (1, 'Kim'), (2, 'Alexandria Johnson'), (3, 'Lee');
OUTPUT
Query OK, 0 rows affected (0.02 sec)

Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0
Reproducerun as lab_a
ALTER TABLE customers MODIFY name VARCHAR(10);
✕ ERROR
ERROR 1265 (01000): Data truncated for column 'name' at row 2
Checkrun as lab_a
SELECT id, name, CHAR_LENGTH(name) AS len FROM customers WHERE CHAR_LENGTH(name) > 10;
OUTPUT
+----+--------------------+------+
| id | name               | len  |
+----+--------------------+------+
|  2 | Alexandria Johnson |   18 |
+----+--------------------+------+
1 row in set (0.00 sec)

Find the rows that would not fit with CHAR_LENGTH(name) > 10 first. Here VARCHAR(20) was chosen instead, and the ALTER succeeded with all three rows intact.

After the fixrun as lab_a
ALTER TABLE customers MODIFY name VARCHAR(20);
SELECT * FROM customers ORDER BY id;
✓ SUCCESS
Query OK, 3 rows affected (0.03 sec)
Records: 3  Duplicates: 0  Warnings: 0

+----+--------------------+
| id | name               |
+----+--------------------+
|  1 | Kim                |
|  2 | Alexandria Johnson |
|  3 | Lee                |
+----+--------------------+
3 rows in set (0.00 sec)

FAQ

How do I fix MySQL error 1265 Data truncated for column?

Check the column type and the value at the row in the message. For ENUM, add the value to the list or change the data; for numbers, clean the text before inserting.

Why does ALTER TABLE MODIFY ENUM give Data truncated for column?

Some rows still use a value you are removing from the ENUM. Update those rows first, then run the ALTER again.

Is error 1265 a warning or an error?

Its SQLSTATE is 01000 (a warning class), but in strict mode, the MySQL 8.4 default, the statement fails with ERROR 1265.

What does 'at row 1' mean in error 1265?

It is the row number within the statement (the VALUES list, the SELECT result or the table being altered), not the primary key.

Why does ALTER TABLE MODIFY VARCHAR give Data truncated for column?

Some existing values are longer than the new length. Find them with CHAR_LENGTH(col) > new_length, then fix the data or choose a longer size. The failed ALTER changes nothing.

How we verify

Each scenario starts from fresh database users. A script runs the setup, confirms the exact error code, applies the fix and runs the statement again. The output shown is what the database printed, saved by the script.

lab_a and lab_b are ordinary users created for the test, each with full rights on a database of the same name (its default database); root is the administrator. MySQL 8.4.13