3258
MariaDBERRORNotableCharacter SetsHIGH confidence

Collation does not match character set

Production Risk

Low — DDL fails; no data is written.

How to reproduce
trigger — this will error
trigger — this will error
CREATE TABLE t1 (name VARCHAR(100) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci);

expected output

ERROR 3258 (HY000): COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'.

Fix

Match collation to charset

Match collation to charset
CREATE TABLE t1 (name VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci);

Why this works

Using a collation that belongs to the same charset resolves the mismatch.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3258 ER_COLLATION_CHARSET_MISMATCH2

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MariaDB errors