Mysql DB create and Grant User
--------------
Four commands to create a mysql Database, create user and grant privileges on the created DB
**Replace dbname, username and host with your own values:**
1. login to mysql (entering root password)
mysql -u root -p
2. Create DB
create database dbname;
3. Create user and grant privileges on the new DB. Remember the single quotes! And change the host if required
GRANT ALL PRIVILEGES ON dbname.* To 'username'@'localhost' IDENTIFIED BY 'superstrongpassword';
4. Flush privileges
FLUSH PRIVILEGES;
Done :)
** Mysql commands all in one line:**
mysql> create database dbname; GRANT ALL PRIVILEGES ON dbname.* To 'username'@'host' IDENTIFIED BY 'superstrongpassword'; FLUSH PRIVILEGES;