3128
MySQLERRORNotableDDLHIGH confidence
ALTER TABLE not supported: AUTO_INCREMENT change requires table copy
Production Risk
Low — AUTO_INCREMENT changes are metadata operations; main risk is table lock during COPY.
What this means
Changing the AUTO_INCREMENT value or adding an AUTO_INCREMENT column cannot be done with ALGORITHM=INPLACE in this context and requires a table copy.
Why it happens
- 1AUTO_INCREMENT attribute added or modified while ALGORITHM=INPLACE is forced.
- 2Decreasing the AUTO_INCREMENT counter requires a table rebuild.
How to reproduce
trigger — this will error
trigger — this will error
ALTER TABLE t1 AUTO_INCREMENT = 1000, ALGORITHM=INPLACE;
expected output
ERROR 3128 (HY000): ALGORITHM=INPLACE is not supported. Reason: AUTO_INCREMENT change requires table copy.
Fix 1
Use ALGORITHM=COPY
Use ALGORITHM=COPY
ALTER TABLE t1 AUTO_INCREMENT = 1000, ALGORITHM=COPY;
Why this works
Full rebuild allows the AUTO_INCREMENT counter to be reset.
Fix 2
Use default algorithm
Use default algorithm
ALTER TABLE t1 AUTO_INCREMENT = 1000;
Why this works
MySQL selects the appropriate algorithm automatically.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 3128 ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_AUTOINC2
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev