Sat Aug 14 06:50:16 EEST 2010

How to revoke user global privileges in MySQL

I've recently realized one of the users I have added to one of the MySQL servers I do manage has actually some included a list of some of the global privileges.
This extra privileges the user had was actually something that was to be removed since the user is not supposed to be able to list all existent databases on the MySQL server and things alike:

You can see below the excact SQL queries I had to issue to revoke the granted global privileges for the username.
Note to change the username before you execute the below queries:

REVOKE ALL PRIVILEGES ON * . * FROM 'username'@'localhost';
REVOKE GRANT OPTION ON * . * FROM 'username'@'localhost';
GRANT USAGE ON * . * TO 'username'@'localhost' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIO