Bug #74688 REVOKE USAGE FROM user returns only warning
Submitted: 4 Nov 2014 16:20 Modified: 17 Jul 2015 14:47
Reporter: Peter Laursen (Basic Quality Contributor) Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[4 Nov 2014 16:20] Peter Laursen
Only a warning appears when trying to REVOKE USAGE. I think it should return an error. 

How to repeat:
SET sql_mode = ''; -- in order to ensure that NO_AUTO_CREATE_USER is not set.

GRANT SELECT ON world.* TO someone@localhost;
REVOKE USAGE ON *.* FROM someone@localhost; -- no error!
-- 1141  There is no such grant defined for user 'someone' on host 'localhost'
SHOW GRANTS FOR someone@localhost;
Grants for someone@localhost                        
GRANT USAGE ON *.* TO 'someone'@'localhost'         
GRANT SELECT ON `world`.* TO 'someone'@'localhost'  

-- however here we have an error
REVOKE SELECT ON sakila.* FROM someone@localhost;
-- Error Code: 1141
-- There is no such grant defined for user 'someone' on host 'localhost'

Suggested fix:
Return a (meaningful) error ("USAGE cannot be revoked. It is not a real privilege. You must DROP USER" or smilar) and not only a warning.

BTW: Since GRANT can create a user why does not then REVOKE USAGE DROP a user? This is inconsistent IMO. But probably it is rather GRANT itself that is odd in MySQL. So let that be.