mysqldude
Error codes › 1265

MySQL & MariaDB error 1265: Data truncated for column

Error messageData truncated for column '…' at row …
Example from our test runs: Data truncated for column 'sdate' at row 1 (5.6.51)

A value had to be cut or replaced to fit the column: an unknown ENUM value, a string into a number column, or too many decimals. An error in strict mode, a warning otherwise.

MySQLMariaDB
SymbolWARN_DATA_TRUNCATEDWARN_DATA_TRUNCATED
SQLSTATE0100001000
TypeServer errorServer error
Versionsevery release since 5.0 activeevery release since 5.5 active

What it means

The server couldn’t store the value as given. In strict mode it refuses the row; without strict mode it stores a converted value (an empty string for an invalid ENUM, the leading digits of '12abc' in an INT) and raises warning 1265.

Why it happens

  • A value that isn’t in an ENUM or SET list, often a new option the application started sending before the schema was changed.
  • A string that isn’t fully numeric into a numeric column ('1,200', '12 kg'). Some of these give 1366 instead.
  • ALTER TABLE … MODIFY to a smaller or different type when existing rows don’t fit.
  • LOAD DATA with the wrong field separator, so a whole line lands in the first column.
  • Rounding extra decimals in a DECIMAL column raises only a note 1265, which is not an error even in strict mode.

How to fix it

  • For ENUM, add the new value. Append it at the end of the list, so stored values keep their internal index and the change doesn’t need a table rebuild.
  • Clean the data before inserting (strip units and thousands separators), or use a column type that matches the data.
  • Before an ALTER TABLE that narrows a column, find rows that won’t fit, e.g. SELECT … WHERE CHAR_LENGTH(col) > 20.

Reproduce it yourself

These steps are the exact test our harness runs. Use a scratch server, never production.

  1. Connect with mysql -u root -p and create a scratch database and the test data:

    CREATE DATABASE demo;
    USE demo;
    CREATE TABLE t (size ENUM('S','M','L'));
  2. Run:

    SET SESSION sql_mode = 'STRICT_TRANS_TABLES';
    INSERT INTO t VALUES ('XL');

You get: Data truncated for column 'size' at row 1(11.8.9)

Verified fixes

  1. Add the value to the column definition (append it at the end so existing values keep their index)

    SET SESSION sql_mode = 'STRICT_TRANS_TABLES';
    ALTER TABLE t MODIFY size ENUM('S','M','L','XL');
    INSERT INTO t VALUES ('XL');
    SELECT size FROM t;

Tested on

StepMySQLMariaDB
5.65.78.08.4910.610.1111.411.8
Insert a value that isn't in the ENUM list, in strict mode
repro
✓ 1265✓ 1265✓ 1265✓ 1265✓ 1265✓ 1265✓ 1265✓ 1265✓ 1265
Without strict mode the row is stored with an empty string (warning 1265)
version check
⚠ 1265⚠ 3090,1265⚠ 1265⚠ 1265⚠ 1265⚠ 1265⚠ 1265⚠ 1265⚠ 1265
Add the value to the column definition (append it at the end so existing values keep their index)
fix
✓⚠ 3135,3090⚠ 3135⚠ 3135⚠ 3135✓✓✓✓
Insert a value that isn't in the ENUM list, in strict mode repro
MySQL 5.6✓ 12655.7✓ 12658.0✓ 12658.4✓ 12659✓ 1265
MariaDB 10.6✓ 126510.11✓ 126511.4✓ 126511.8✓ 1265
Without strict mode the row is stored with an empty string (warning 1265) version check
MySQL 5.6⚠ 12655.7⚠ 3090,12658.0⚠ 12658.4⚠ 12659⚠ 1265
MariaDB 10.6⚠ 126510.11⚠ 126511.4⚠ 126511.8⚠ 1265
Add the value to the column definition (append it at the end so existing values keep their index) fix
MySQL 5.6✓5.7⚠ 3135,30908.0⚠ 31358.4⚠ 31359⚠ 3135
MariaDB 10.6✓10.11✓11.4✓11.8✓
✓works ✓ 1062fails with the error the step demonstrates ⚠works with a warning ≠runs, result differs ✗fails Tested 2026-11-25 on 5.6.51, 5.7.44, 8.0.46, 8.4.13, 9.7.4, 10.6.28, 10.11.19, 11.4.13, 11.8.9
What the warnings and failures say (4)
  • Without strict mode the row is stored with an empty string (warning 1265) (MySQL 5.6, MySQL 8.0, MySQL 8.4, MySQL 9, MariaDB 10.6, MariaDB 10.11, MariaDB 11.4, MariaDB 11.8): warning 1265: Data truncated for column 'size' at row 1
  • Without strict mode the row is stored with an empty string (warning 1265) (MySQL 5.7): warning 3090: Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.; warning 1265: Data truncated for column 'size' at row 1
  • Add the value to the column definition (append it at the end so existing values keep their index) (MySQL 5.7): warning 3135: 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with stric; warning 3090: Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
  • Add the value to the column definition (append it at the end so existing values keep their index) (MySQL 8.0, MySQL 8.4, MySQL 9): warning 3135: 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with stric

Related errors

  • 1264 ER_WARN_DATA_OUT_OF_RANGEexplained
  • 1366 ER_TRUNCATED_WRONG_VALUE_FOR_FIELDexplained
  • 1406 ER_DATA_TOO_LONGexplained
  • 1292 ER_TRUNCATED_WRONG_VALUEexplained

Where this error shows up in our guides