MySQL ERROR 1366: Incorrect string value: '\xF0\x9F\x98\x80' for column
The text contains characters (usually emoji) that the column’s character set can’t store — the column or connection is utf8/utf8mb3 instead of utf8mb4.
Incorrect string value Meaning
MySQL’s legacy utf8 stores at most 3 bytes per character. Emoji and some CJK characters need 4 bytes (\xF0…). Both the column/table and the connection charset must be utf8mb4.
Common causes
- Column or table uses utf8/utf8mb3 or latin1
- Connection charset not utf8mb4 (DSN missing
charset=utf8mb4) - Database default charset outdated after migration
⚡ Quick fix
- Convert the table:
ALTER TABLE t CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - Use
charset=utf8mb4in the connection DSN - Set database default to utf8mb4 for new tables
Detailed fix by platform
MySQL
- Convert database and table:sql
ALTER DATABASE appdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE comments CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
PHP
- PDO:
mysql:host=…;dbname=…;charset=utf8mb4. On old MySQL 5.6, indexed VARCHAR(255) columns may need to shrink to 191 for utf8mb4.
How to diagnose
- Column —
SHOW FULL COLUMNS FROM t— collation? - Connection —
SHOW VARIABLES LIKE 'character_set_%'from the app connection - Data — Emoji or 4-byte characters present?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in MySQL
Other ways to find it
Where this error sits
Origin: Data. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 9 Oct 2026