Friday, August 17th 2012
How to create MySQL users accounts and grant privileges
Create a new database named mydb
with user named mydbuser
and grant all PRIVILEGES:
CREATE DATABASE mydb;
CREATE USER 'mydbuser'@'%' IDENTIFIED BY 'PASSWORD_HERE';
GRANT ALL PRIVILEGES ON `mydb`.* TO 'mydbuser'@'%';
SHOW GRANTS for 'mydbuser';
SHOW GRANTS for 'mydbuser'@'%';
Read only:
GRANT SELECT, SHOW VIEW ON `mydb`.* TO 'mydb-reader'@'%';