<p>MySQL cannot revoke privileges from a routine that is being dropped, leaving orphaned privilege records and aborting the DROP statement.</p>
<p>MySQL Error 1405: ER_PROC_AUTO_REVOKE_FAIL occurs when the server fails to remove all privileges tied to a stored procedure or function being dropped. Update privilege tables, ensure you hold SUPER or DROP ROUTINE rights, then reissue DROP ROUTINE to resolve the issue.</p>
Failed to revoke all privileges to dropped routine
Error 1405 appears during DROP PROCEDURE or DROP FUNCTION operations when MySQL cannot automatically revoke all existing privileges that reference the routine. The server rolls back the drop action and raises the error to protect privilege integrity.
The problem is serious because it leaves the routine in limbo: it still exists, but administrators think it was removed. Ignoring the alert can lead to orphaned objects, confused deployments, and potential security gaps.
The error usually surfaces after a routine accumulates explicit EXECUTE privileges granted to multiple users, or if privilege rows become corrupt. Attempts to drop the routine force MySQL to clean up related mysql.procs_priv rows, and any failure here triggers 1405.
It is commonly reported on MySQL 5.7 and 8.0 instances upgraded from older versions, where privilege-table formats differ, or on servers with replication lag that locks the privilege tables.
Leaving a routine half-dropped can break deployments, cause inconsistent backups, and expose dormant code to unauthorized calls. Rapid remediation restores schema consistency and keeps least-privilege policies intact.
Broken privilege rows prevent DELETE actions during DROP ROUTINE, so MySQL aborts the operation.
The session user lacks authority to manipulate other users privileges, blocking automatic revoke.
If the definer user no longer exists or lacks proper host entry, MySQL may fail privilege cleanup.
Replication threads or long transactions can lock privilege tables, causing the revoke to time out and fail.
Certain releases have known defects with privilege revocation logic; upgrading resolves the issue.
Raised when the current user lacks permission to remove a routine. Unlike 1405, no revoke is attempted.
Indicates an outdated privilege table schema, often leading to 1405 during routine operations.
Appears when dropping a non-existent trigger; similar privilege issues may accompany it.
No. The DROP statement is rolled back. The routine still exists until you successfully drop it without errors.
Ignoring them leaves security gaps and future errors. Always clean or repair the mysql.procs_priv table.
A restart clears locks but will not repair corrupted privilege rows. Perform the manual cleanup steps first.
Galaxy highlights privilege errors, logs failed drops, and lets teams co-edit corrective SQL safely.