1115
MySQLERRORCommonConfigurationHIGH confidence

Unknown character set

Production Risk

Low — DDL fails; no data loss.

What this means

ER_UNKNOWN_CHARACTER_SET (1115, SQLSTATE 42000) is raised when a CHARACTER SET name specified in a CREATE TABLE, ALTER TABLE, or SET NAMES statement does not exist in the MySQL server's compiled-in character set list.

Why it happens
  1. 1Typo in the character set name (e.g., "utf-8" instead of "utf8")
  2. 2Using a character set name from a different database system (e.g., PostgreSQL's "UTF8" syntax)
  3. 3The MySQL build does not include the requested character set
How to reproduce
trigger — this will error
trigger — this will error
CREATE TABLE t (name VARCHAR(50) CHARACTER SET utf-8);

expected output

ERROR 1115 (42000): Unknown character set: 'utf-8'

Fix

Use the correct MySQL character set name

WHEN Always — MySQL uses "utf8mb4" for full Unicode support.

Use the correct MySQL character set name
-- List available character sets:
SHOW CHARACTER SET;
-- Use the correct name:
CREATE TABLE t (name VARCHAR(50) CHARACTER SET utf8mb4);

Why this works

MySQL character set names use underscores, not hyphens; "utf8mb4" is the correct name for 4-byte UTF-8.

What not to do

Use "utf8" instead of "utf8mb4" for new tables

MySQL's "utf8" is actually utf8mb3 (3-byte only) and cannot store 4-byte characters like emoji; always use "utf8mb4".

Sources
Official documentation ↗

MySQL 8.0 — 1115 ER_UNKNOWN_CHARACTER_SET

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

← All MySQL errors