MySQL User and Permission

index > dev > database

User

Create:

CREATE USER 'user'@'host' IDENTIFIED BY 'password';

Drop:

DROP USER 'user'@'host';

Permission

Privileges:

CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES, RELOAD

Grant:

GRANT <privilege> ON <database.table> TO 'user'@'host';

Grant All:

GRANT ALL PRIVILEGES ON *.* TO 'user'@'host' WITH GRANT OPTION;

Flush:

FLUSH PRIVILEGES

Revoke:

REVOKE <type_of_permission> ON <database.table> FROM 'user'@'host';

Show:

SHOW GRANTS FOR 'user'@'host';