From: http://dev.mysql.com/doc/refman/5.0/en/drop-database.html
...when a database is dropped, user privileges on the database are not automatically dropped.
So the question becomes, how do you revoke all privileges for all users on a MySQL DB? I imagine it's simple, but I'm surprised I haven't been able to find this anywhere.
In this syntax: First, specify a list of comma-separated privileges that you want to revoke from a user account after the REVOKE keyword. Second, specify the object type and privilege level of the privileges after the ON keyword; check it out the GRANT statement for more information on privilege level.
REVOKE removes privileges, but does not remove rows from the mysql. user system table. To remove a user account entirely, use DROP USER .
The syntax for the revoking privileges on a function or procedure in MySQL is: REVOKE EXECUTE ON [ PROCEDURE | FUNCTION ] object FROM user; EXECUTE. The ability to execute the function or procedure is being revoked.
: to annul by recalling or taking back : rescind. revoke a will. : to bring or call back.
REVOKE ALL PRIVILEGES ON *.* FROM '<user_name>'@'localhost';
REVOKE ALL PRIVILEGES ON *.* FROM '<user_name>'@'%';
Eg.:
REVOKE ALL PRIVILEGES ON *.* FROM 'jeffrey'@'localhost';
REVOKE ALL PRIVILEGES ON *.* FROM 'jeffrey'@'%';
You can revoke all privileges for a specific user with this syntax:
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user [, user] ...
FLUSH PRIVILEGES;
which drops all global, database, table, column, and routine privileges for the named user or users
Not sure if there's a way to do this for all users at once, though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With