MySQL Create use and give permission

22 Apr 2019

Create User

CREATE USER 'username'@'%' IDENTIFIED BY '<secret>';

Grant all privileges

GRANT ALL PRIVILEGES ON `db_name`.* TO 'username'@'%';

Grant read privileges

GRANT SELECT ON `db_name`.* TO 'username'@'%';

Show grants

SHOW GRANTS FOR username;