1280
MariaDBerrordatahigh confidence
Invalid character string
Production Risk
Medium — inserts fail or data is silently mangled depending on sql_mode.
What this means
A string literal or column value contains a byte sequence that is not valid for the declared character set (commonly utf8mb4).
Why it happens
- 1Inserting latin1-encoded bytes into a utf8mb4 column
- 2Binary data mistakenly stored in a character column
- 3Client and server character set mismatch
How to reproduce
trigger — this will error
trigger — this will error
INSERT INTO t (name) VALUES (0x92);
expected output
ERROR 1280 (HY000): Invalid utf8mb4 character string: '92'
Fix 1
Fix client character set
Fix client character set
SET NAMES utf8mb4;
Why this works
Ensures the client sends data in the expected encoding.
Fix 2
Convert column to correct charset
Convert column to correct charset
ALTER TABLE t CONVERT TO CHARACTER SET utf8mb4;
Why this works
Migrates stored data to the target charset.
What not to do
✕
Version notes
Sources
Official documentation ↗
MySQL 8.0 — 1280 ER_INVALID_CHARACTER_STRING
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev