1141
MariaDBERRORCommonSecurityHIGH confidence

There is no such grant defined for user on host

Production Risk

Low — REVOKE is a no-op; no privilege change occurs.

What this means

ER_NONEXISTING_GRANT (1141, SQLSTATE 42000) is raised when REVOKE is executed for a privilege that was never granted to the specified user on the specified host.

Why it happens
  1. 1REVOKE on a privilege the user does not hold
  2. 2Wrong host specified in REVOKE (e.g., '%' vs 'localhost')
  3. 3Privilege was already revoked previously
How to reproduce
trigger — this will error
trigger — this will error
REVOKE SELECT ON mydb.* FROM 'user'@'localhost';
-- when user never had SELECT on mydb.*

expected output

ERROR 1141 (42000): There is no such grant defined for user 'user' on host 'localhost'

Fix

Check current grants before revoking

WHEN Always.

Check current grants before revoking
SHOW GRANTS FOR 'user'@'localhost';
-- Only revoke grants that exist

Why this works

SHOW GRANTS lists all current privileges for the user; only revoke what is shown.

What not to do

Ignore 1141 in automation scripts

While the error is non-destructive, it indicates a script is out of sync with the actual grant state; the script should be corrected.

Sources
Official documentation ↗

MySQL 8.0 — 1141 ER_NONEXISTING_GRANT

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MariaDB errors