1102
MySQLERRORCommonDDLHIGH confidence
Incorrect database name
Production Risk
Low — DDL fails; no data loss.
What this means
ER_WRONG_DB_NAME (1102, SQLSTATE 42000) is raised when a database name contains invalid characters, is too long, or is otherwise syntactically incorrect.
Why it happens
- 1Database name contains a slash, backslash, or other forbidden character
- 2Database name exceeds 64 characters
- 3Database name is a reserved word used without backtick quoting
How to reproduce
trigger — this will error
trigger — this will error
CREATE DATABASE `my/database`;
expected output
ERROR 1102 (42000): Incorrect database name 'my/database'
Fix
Use only alphanumeric characters and underscores in database names
WHEN Always.
Use only alphanumeric characters and underscores in database names
CREATE DATABASE my_database;
Why this works
Simple alphanumeric names avoid all quoting and character-set issues across different operating systems.
What not to do
✕ Use path-separator characters in database names
MySQL maps database names to OS directory names; characters like / or \ are invalid in directory names on most OSes.
Sources
Official documentation ↗
MySQL 8.0 — 1102 ER_WRONG_DB_NAME
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev