dataiotech Labs
dbaguidedbaguideDBAdataxtoolsdataopsphere
Home/Error Library/mysql-incorrect-string-value-utf8mb4
MySQL
MySQL 8.4 LTS / 9.7 LTSCharset & Collation
6 min read
ERROR 1366 (HY000): Incorrect string value

MySQL "Incorrect string value" — Why Cannot Emojis Be Saved?

Root causes of MySQL Error 1366 when storing 4-byte UTF-8 emojis into utf8mb3, converting tables to utf8mb4_0900_ai_ci, connection charset parameters, and index size recalculation.

Reviewed by:Principal Database Reliability Architect
Tested Versions: MySQL 9.7.4 LTS & 8.4.13 LTS (Debian / Docker) | Tarihsel: MySQL 8.0, 5.7

Operational Verification & Reliability Metadata

Last Technical Review: 29 Ekim 2026
Tested VersionsMySQL 9.7.4 LTS & 8.4.13 LTS | Tarihsel: MySQL 8.0.36, 5.7.44
Required PrivilegesALTER TABLE and session variable configuration privileges
Risk Assessment
MediumCONVERT TO CHARACTER SET rebuilds table under metadata locks and doubles disk consumption
Expected OutputSeamless insertion of 4-byte UTF-8 emoji characters under utf8mb4_0900_ai_ci
Rollback Procedure:Restore from pre-migration backup or abort pt-online-schema-change trigger
MySQL 8.4 Reference Manual: The utf8mb4 Character Set
First 60 Seconds Emergency Protocol:

The error string is a symptom, not the root cause. Do not restart the server blindly. Run the diagnostic queries below to pinpoint the actual failure mode.

▸Symptoms

plaintext
ERROR 1366 (HY000): Incorrect string value: '\xF0\x9F\x98\x80' for column 'yorum' at row 1

The byte sequence \xF0\x9F\x98\x80 represents the 4-byte 😀 emoji. Legacy utf8 in MySQL is limited to 3 bytes (utf8mb3).


▸Resolution Patterns

  1. 1Convert Table to utf8mb4:
sql
ALTER TABLE yorumlar CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
  1. 1Configure Client Connection:
sql
SET NAMES utf8mb4;
  1. 1Recalculate Index Key Widths:

Converting to utf8mb4 inflates index size from 3 to 4 bytes per character, potentially triggering MySQL Error 1071.

Other Database Error Triage Playbooks

Other battle-tested diagnostic guides for high-severity database errors.

All Errors (50)