Description:
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!
SHOW WARNINGS;
-- 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.
Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders. It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: 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! SHOW WARNINGS; -- 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.