1CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
2GRANT ALL PRIVILEGES ON * . * TO 'user'@'localhost';
3FLUSH PRIVILEGES;
1CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
2GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
3FLUSH PRIVILEGES;
1#in the case below, your username is dbuser
2#and we assume that the mysql db is located in the same server or box from where you want to access it from
3#after the IDENTIFIED BY and within the single qoute (') you you should replace 'complexPassword' with a password your desire
4CREATE USER 'dbuser'@'localhost' IDENTIFIED BY 'complexPassword';
5
6#we assume that the name of your database is db_name
7#the command below grants the user you created with privilege to only database db_name
8#if your want dbuser to have access to all database the replace db_name with *
9GRANT ALL PRIVILEGES ON db_name . * TO 'dbuser'@'localhost';
10
11#the command below reloads the privileges of mysql with your new user privileges
12FLUSH PRIVILEGES;
13
14#don't forget give a thumbs up
1CREATE USER 'newuser'@'%' IDENTIFIED BY 'user_password';
2GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'%';
3SHOW GRANTS FOR 'newuser'@'%';
4FLUSH PRIVILEGES;