1326
MariaDBerrorstored-procedureshigh confidence
Failed to ALTER PROCEDURE
Production Risk
Medium — routine metadata may be in an inconsistent state.
What this means
ALTER PROCEDURE or ALTER FUNCTION failed and MySQL could not restore the previous state.
Why it happens
- 1Disk full or I/O error during the alter
- 2Insufficient privileges
- 3Corrupt data dictionary entry
How to reproduce
trigger — this will error
trigger — this will error
ALTER PROCEDURE my_proc SQL SECURITY INVOKER;
expected output
ERROR 1326 (HY000): Failed to ALTER PROCEDURE my_proc; restore previous state
Fix 1
Check disk space and privileges
Check disk space and privileges
SHOW GRANTS FOR CURRENT_USER();
Why this works
Ensures the user has ALTER ROUTINE privilege.
Fix 2
Drop and recreate the routine
Drop and recreate the routine
DROP PROCEDURE IF EXISTS my_proc; CREATE PROCEDURE my_proc() ...
Why this works
Atomic replacement avoids partial state.
Sources
Official documentation ↗
MySQL 8.0 — 1326 ER_SP_CANT_ALTER
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev