2031
MySQLERRORNotableAccess ControlHIGH confidence
No such grant for table
Production Risk
Low — REVOKE is rejected.
What this means
A REVOKE statement attempted to revoke a table-level privilege that was never granted. The privilege does not exist in the mysql.tables_priv table for the specified user@host and table.
Why it happens
- 1Revoking a table-level privilege that was never granted.
- 2Wrong table name or database in the REVOKE statement.
- 3Privilege was granted at a higher scope (database-level) not table-level.
How to reproduce
trigger — this will error
trigger — this will error
REVOKE SELECT ON mydb.t1 FROM 'user'@'%'; -- table-level grant never existed
expected output
ERROR 2031 (42000): There is no such grant defined for user 'user' on host '%' on table 't1'.
Fix 1
Verify existing grants
Verify existing grants
SHOW GRANTS FOR 'user'@'%';
Why this works
Confirms the exact grant scope and object.
Fix 2
Revoke at the correct scope
Revoke at the correct scope
REVOKE SELECT ON mydb.* FROM 'user'@'%'; -- if granted at DB level
Why this works
REVOKE must match the scope at which the privilege was originally granted.
Sources
Official documentation ↗
MySQL 8.0 — 2031 ER_NONEXISTING_TABLE_GRANT
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev