This is an old revision of the document!
MySQL Users
- This is better known as privileges
Show Grants
SHOW GRANTS [FOR user]; SHOW GRANTS; SHOW GRANTS FOR 'root'@'localhost'; SHOW GRANTS FOR CURRENT_USER; SHOW GRANTS FOR CURRENT_USER();
Grants
Adding a New User
- Global Privileges (all databases and tables):
GRANT ALL PRIVILEGES ON *.* TO username@localhost IDENTIFIED BY 'password';
- Global Privileges for “acme” database (and all acme tables):
GRANT ALL PRIVILEGES ON acme.* TO username@localhost IDENTIFIED BY 'password';
Removing a User
- revoke removes a user from all privilege tables, but not the user table; you must use one of the following:
Flushing Privileges
You need to flush privileges after manually making changes to user tables.
FLUSH PRIVILEGES;