1665
MySQLERRORNotableSchemaHIGH confidence
Unknown ALTER TABLE LOCK value
Production Risk
Low — the ALTER is rejected; no data change.
What this means
The LOCK clause in an ALTER TABLE statement specifies an unrecognised lock mode.
Why it happens
- 1A typo or unsupported value was used in LOCK=.
How to reproduce
trigger — this will error
trigger — this will error
ALTER TABLE t ADD COLUMN x INT, LOCK=PARTIAL;
expected output
ERROR 1665 (HY000): Unknown LOCK 'PARTIAL'.
Fix
Use a valid LOCK value
Use a valid LOCK value
ALTER TABLE t ADD COLUMN x INT, LOCK=NONE; -- Valid values: DEFAULT, NONE, SHARED, EXCLUSIVE
Why this works
Using a supported lock level resolves the error.
Sources
Official documentation ↗
MySQL 8.0 — 1665 ER_UNKNOWN_ALTER_LOCK
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev