1474
MySQLERRORNotableStored RoutinesHIGH confidence
Incorrect routine name — contains invalid characters
Production Risk
Low — DDL error; the routine will not be created.
What this means
ER_SP_WRONG_NAME (1474, SQLSTATE HY000) is raised when a stored routine name contains characters that are not permitted in MySQL identifiers.
Why it happens
- 1Using special characters not allowed in routine names
- 2Routine name starting with a number or containing spaces without backtick quoting
How to reproduce
trigger — this will error
trigger — this will error
CREATE PROCEDURE my-proc() BEGIN SELECT 1; END; -- Hyphen is not valid in an unquoted identifier
expected output
ERROR 1474 (HY000): Incorrect routine name 'my-proc'
Fix
Use valid identifier characters or backtick quoting
Use valid identifier characters or backtick quoting
-- Use underscores instead of hyphens: CREATE PROCEDURE my_proc() BEGIN SELECT 1; END; -- Or quote with backticks: CREATE PROCEDURE `my-proc`() BEGIN SELECT 1; END;
Why this works
MySQL identifiers follow specific naming rules; use letters, digits, underscores, and dollar signs.
Sources
Official documentation ↗
MySQL 8.0 — 1474 ER_SP_WRONG_NAME
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev