1080
MySQLERRORCommonQueryHIGH confidence
Incorrect usage of LOCK TABLES / GROUP BY
Production Risk
Low — statement is rejected; no data is affected.
What this means
ER_WRONG_USAGE (1080, SQLSTATE HY000) is raised when SQL constructs are combined in an invalid way, such as using GROUP BY with a procedure, or combining LOCK TABLES with certain statements.
Why it happens
- 1Using GROUP BY inside a stored procedure call context that does not support it
- 2Combining LOCK TABLES with a statement type that is incompatible
- 3Using WITH ROLLUP with ORDER BY in MySQL versions that do not support it
How to reproduce
trigger — this will error
trigger — this will error
-- Context-dependent; typically a disallowed combination of clauses
expected output
ERROR 1080 (HY000): Incorrect usage of LOCK TABLES and MERGE/TEMPORARY TABLE
Fix
Restructure the query to separate the incompatible clauses
WHEN The error message identifies the specific combination.
Restructure the query to separate the incompatible clauses
-- Consult the error message for the specific combination; -- separate LOCK TABLES from TEMPORARY TABLE usage, etc.
Why this works
Each specific combination has its own restriction; the error message names both constructs.
What not to do
✕ Ignore 1080 and assume the statement ran correctly
1080 always means the statement was rejected; no operation was performed.
Sources
Official documentation ↗
MySQL 8.0 — 1080 ER_WRONG_USAGE
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev