mysqldude
Error codes › 1366

MySQL & MariaDB error 1366: Incorrect string value (or incorrect integer value)

MySQLIncorrect … value: '…' for column '…' at row …
MariaDBIncorrect … value: '…' for column `…`.`…`.`…` at row …
Example from our test runs: Incorrect integer value: '' for column 'lNumber' at row 1 (5.7.44) · Incorrect integer value: '' for column ``.``.`lNumber` at row 0 (10.11.19)

A value can't be stored in the column's type or character set. Most often an emoji or other 4-byte character going into a utf8mb3 ("utf8") column, or text going into a number column in strict mode.

MySQLMariaDB
SymbolER_TRUNCATED_WRONG_VALUE_FOR_FIELDER_TRUNCATED_WRONG_VALUE_FOR_FIELD
SQLSTATEHY00022007
TypeServer errorServer error
Versionsevery release since 5.0 activeevery release since 5.5 active

What it means

Incorrect string value: '\xF0\x9F\x91\x8D' for column 'txt' at row 1 shows the raw bytes the server couldn’t store. A value starting \xF0 is a 4-byte UTF-8 character (emoji, some CJK and maths symbols), which the 3-byte utf8mb3 character set, called plain utf8 in older versions, can’t hold. Incorrect integer value: 'abc' for column 'i' is the same error for numbers.

In strict mode (the default from MySQL 5.7 and in MariaDB) this is an error. In non-strict mode, which was the MySQL 5.6 default, the value is mangled (? or 0) with only a warning, so data was silently lost.

Why it happens

  • Tables created years ago with CHARSET=utf8 (utf8mb3), now receiving emoji from web forms or mobile apps.
  • The connection character set doesn’t match the data: a client sending UTF-8 while the connection says latin1.
  • Strings or empty strings sent for INT, DECIMAL or DATE columns.

How to fix it

  • Convert the table to utf8mb4: ALTER TABLE notes CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci; (MariaDB: utf8mb4_unicode_ci or utf8mb4_uca1400_ai_ci). Watch index length limits (1071), because utf8mb4 needs 4 bytes per character.
  • Make the connection utf8mb4 too: SET NAMES utf8mb4, or charset=utf8mb4 in the driver DSN.
  • Validate or convert numeric input in the application; send NULL rather than '' for missing numbers.

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 notes (txt VARCHAR(50) CHARACTER SET utf8mb3);
  2. Run:

    INSERT INTO notes VALUES ('thumbs up 👍');

You get: Incorrect string value: '\xF0\x9F\x91\x8D' for column `t_0`.`notes`.`txt` at row 1(11.8.9)

Verified fixes

  1. Convert the column (or table) to utf8mb4

    ALTER TABLE notes MODIFY txt VARCHAR(50) CHARACTER SET utf8mb4;
    INSERT INTO notes VALUES ('thumbs up 👍');
    SELECT COUNT(*) FROM notes;

Tested on

StepMySQLMariaDB
5.65.78.08.4910.610.1111.411.8
Store an emoji (4-byte UTF-8) in a utf8mb3 ("utf8") column
repro
≠✓ 1366✓ 1366✓ 1366✓ 1366✓ 1366✓ 1366✓ 1366✓ 1366
A non-numeric string into an INT column
version check
≠✓ 1366✓ 1366✓ 1366✓ 1366✓ 1366✓ 1366✓ 1366✓ 1366
Convert the column (or table) to utf8mb4
fix
✓✓✓✓✓✓✓✓✓
Store an emoji (4-byte UTF-8) in a utf8mb3 ("utf8") column repro
MySQL 5.6≠5.7✓ 13668.0✓ 13668.4✓ 13669✓ 1366
MariaDB 10.6✓ 136610.11✓ 136611.4✓ 136611.8✓ 1366
A non-numeric string into an INT column version check
MySQL 5.6≠5.7✓ 13668.0✓ 13668.4✓ 13669✓ 1366
MariaDB 10.6✓ 136610.11✓ 136611.4✓ 136611.8✓ 1366
Convert the column (or table) to utf8mb4 fix
MySQL 5.6✓5.7✓8.0✓8.4✓9✓
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 (2)
  • Store an emoji (4-byte UTF-8) in a utf8mb3 ("utf8") column (MySQL 5.6): expected error 1366 did not occur
  • A non-numeric string into an INT column (MySQL 5.6): expected error 1366 did not occur

Related errors

  • 1406 ER_DATA_TOO_LONGexplained
  • 1292 ER_TRUNCATED_WRONG_VALUEexplained
  • 1267 ER_CANT_AGGREGATE_2COLLATIONSexplained

Where this error shows up in our guides

  • Basic hash jumbler function · CREATE FUNCTION (NOT DETERMINISTIC, NO SQL) and call it (original) MySQL 5.7 8.0 8.4 9MariaDB 10.6 10.11 11.4 11.8
How the message changed between versions
MariaDB fromSymbolMessage
5.5.68ER_TRUNCATED_WRONG_VALUE_FOR_FIELDIncorrect %-.32s value: '%-.128s' for column '%.192s' at row %lu
10.2.44ER_TRUNCATED_WRONG_VALUE_FOR_FIELDIncorrect %-.32s value: '%-.128T' for column `%.192s`.`%.192s`.`%.192s` at row %lu
11.8.10ER_TRUNCATED_WRONG_VALUE_FOR_FIELDIncorrect %-.32s value: '%-.128sT' for column `%.192s`.`%.192s`.`%.192s` at row %lu