<p>MySQL raises ER_UNKNOWN_ALTER_LOCK (error 1801) when an unsupported value is supplied to the LOCK clause in an ALTER TABLE statement.</p>
<p>MySQL Error 1801: ER_UNKNOWN_ALTER_LOCK appears when ALTER TABLE includes an unsupported LOCK value. Use a valid option (DEFAULT, NONE, SHARED, EXCLUSIVE) or omit the clause to resolve the issue.</p>
Unknown LOCK type '%s'
MySQL throws error 1801 (SQLSTATE HY000) with message "Unknown LOCK type '%s'" when it cannot recognize the value assigned to the LOCK clause in an ALTER TABLE statement.
The LOCK clause instructs MySQL how to lock the table during alteration. Accepted values are DEFAULT, NONE, SHARED, and EXCLUSIVE. Any other token triggers ER_UNKNOWN_ALTER_LOCK.
The error occurs at parse time before the statement executes. It is common after typo mistakes, using outdated documentation, or porting scripts between MySQL versions that support different lock keywords.
A failed ALTER TABLE halts schema migrations, deployment pipelines, and application upgrades. Fixing the syntax quickly keeps release cycles predictable and prevents downtime.
Mistyping NONE as NON, SHARED as SHARE, or similar spelling errors leads to an unknown token.
Using keywords like READ or WRITE that belong to LOCK TABLES, not ALTER TABLE, causes the parser to reject the value.
Legacy scripts may specify LOW_PRIORITY_WRITE or other deprecated values that modern MySQL versions no longer accept.
Automation tools sometimes inject null or empty strings into the LOCK clause, resulting in an unrecognized value at runtime.
Raised when an unsupported ALGORITHM value is used in ALTER TABLE.
Occurs when the session lacks ALTER privilege on the target table.
A generic parse error signaled when SQL syntax is invalid.
DEFAULT, NONE, SHARED, and EXCLUSIVE are supported in MySQL 8.0.
Without the clause, MySQL chooses DEFAULT, which balances concurrency and safety for most alterations.
No. Some operations require strong locks and will override SHARED with EXCLUSIVE if necessary.
Galaxy flags unsupported tokens in real time and suggests valid LOCK keywords through its AI copilot.