MySQL “Incorrect string value” Error Explained and Fixed

Common SQL Errors

Galaxy Team
June 25, 2025
Character Encoding Error

The error appears when you insert or update text that contains characters not representable by the column’s character set or collation.

MySQL
Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is the MySQL “Incorrect string value” error?

MySQL “Incorrect string value” occurs when text contains bytes not representable in the target column’s character set, typically UTF-8 vs. latin1. Convert the column (or connection) to the correct UTF-8 charset to resolve the issue.

Typical Error Message

ERROR 1366 (HY000): Incorrect string value: '\xF0\x9F\x98\x8A' for column 'name' at row 1

Explanation

Table of Contents

What is the MySQL “Incorrect string value” error?

MySQL raises the “Incorrect string value” (error 1366) when it cannot store incoming bytes with the column’s current character set and collation.

The database engine validates every byte sequence against the column definition and aborts when it sees an invalid code point.

The error often surfaces during INSERT or UPDATE statements that involve emojis, accented characters, or any multi-byte UTF-8 sequence while the table or connection is still using latin1, utf8 (3-byte), or another limited encoding.

When does it usually occur?

Developers hit this error after migrating data, importing CSV files, enabling new Unicode features, or receiving user-generated content containing emojis.

It can also appear in replication when source and replica have different character sets.

Why is it critical to fix?

Leaving the mismatch unresolved blocks data writes, breaks applications, and risks silent truncation if sql_mode is not strict. Correct encoding ensures data integrity, search accuracy, and consistent analytics downstream.

.

Common Causes

Client connection uses utf8mb4 but table is latin1

The application sends 4-byte UTF-8 data, yet the target column only understands single-byte latin1, triggering the error.

Table charset is utf8 (3-byte) instead of utf8mb4

Standard utf8 in MySQL cannot represent code points above U+FFFF such as emojis, causing failures on insert.

Mismatched collations between parent and child tables

Foreign-key relationships can reject inserts when referenced and referencing columns differ in charset/collation.

Improper text conversion during import

CSV or dump files encoded in UTF-8 are read as latin1, creating illegal byte sequences in the resulting queries.

.

Related Errors

FAQs

How do I know if my column supports emojis?

Run SHOW FULL COLUMNS and ensure the Collation ends with utf8mb4; any other charset cannot store 4-byte Unicode like emojis.

Can I fix the error without changing table charset?

Yes, encode the data on the client side to a charset the column already supports, but this often leads to loss of characters.

Will altering a table to utf8mb4 slow queries?

Minimal impact for InnoDB; index size grows slightly. Proper collation helps maintain query speed.

How does Galaxy help prevent encoding errors?

Galaxy’s SQL editor highlights charset mismatches in real time and its AI copilot suggests correct ALTER statements, reducing trial-and-error.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo