1270
MySQLERRORNotableAccess ControlHIGH confidence
Can't revoke all privileges for one or more users
Production Risk
Low — REVOKE fails; privileges are unchanged.
What this means
ER_REVOKE_GRANTS (1270, SQLSTATE HY000) is raised when REVOKE ALL PRIVILEGES, GRANT OPTION FROM fails because one or more of the specified users do not exist or do not have the privileges being revoked.
Why it happens
- 1Attempting to revoke privileges from a user that does not exist
- 2Revoking a privilege the user never had
How to reproduce
trigger — this will error
trigger — this will error
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'nonexistent_user'@'localhost'; -- ERROR 1270
expected output
ERROR 1270 (HY000): Can't revoke all privileges for one or more of the requested users
Fix 1
Verify the user exists and check their grants
Verify the user exists and check their grants
SELECT User, Host FROM mysql.user WHERE User = 'myuser'; SHOW GRANTS FOR 'myuser'@'localhost';
Why this works
Confirm the user and their current privileges before attempting REVOKE.
Fix 2
Revoke only the specific privileges the user has
Revoke only the specific privileges the user has
REVOKE SELECT, INSERT ON mydb.* FROM 'myuser'@'localhost';
Why this works
Targeted REVOKE is safer than REVOKE ALL when unsure of current grants.
Sources
Official documentation ↗
MySQL 8.0 — 1270 ER_REVOKE_GRANTS
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev