Frequent SQL commands select

Frequent SQL commands

This is my SQL cheat-sheet for MYSQL. Most of the commands are well known and popular. I don't like the idea of knowing by heart something that can be found easily, it's proofed, and to lazy to write it down instead of coping it.

Grant Provileges

--DBA user
GRANT ALL PRIVILEGES ON schema.* TO 'mydb'@'%' WITH GRANT OPTION;
--Normal user
grant all privileges on schema.* to mydb@localhost identified by 'pass';
--other
GRANT ALL ON *.* to user@localhost IDENTIFIED BY 'pass';
GRANT ALL ON *.* to user@'%' IDENTIFIED BY 'pass';
SHOW GRANTS FOR 'user'@'localhost';
SHOW GRANTS FOR 'user'@'%';

Remove Privileges

REVOKE ALL PRIVILEGES ON user.* FROM 'mydb'@'localhost';
REVOKE ALL PRIVILEGES ON *.* FROM 'user'@'%';
REVOKE ALL PRIVILEGES ON `mydb`.* FROM 'user'@'%';