MySQL - User Management

Create user:

CREATE USER 'user'@'localhost' IDENTIFIED BY 'xxx';
CREATE USER 'user2'@'%' IDENTIFIED BY 'xxx';

Set grant for user:

GRANT ALL PRIVILEGES ON db.* TO 'user'@'localhost';
GRANT ALL PRIVILEGES ON *.* TO 'user2'@'%';

Set password for user:

SET PASSWORD FOR 'user'@'localhost' = PASSWORD('xxx');

Show permissions:

SHOW GRANTS FOR 'root'@'localhost';

Show all users:

select user,host from mysql.user

Revoke all privileges on database level:

REVOKE ALL PRIVILEGES ON db.* FROM 'user'@'localhost';

Drop user:

DROP USER 'user'@'localhost';