Tag Archive: flush

MySQL create databases and user from a to z

How can I create a database and an user to work together in MySQL. Well, it’s quit easy, theres the few MySQL lines you need to use to solve your problem.

Create the database
Create an user
1
CREATE USER 'my_user'@'localhost' IDENTIFIED BY 'my_pass';
Verify user
1
SELECT * FROM mysql.user WHERE User = 'my_user'G
Grant privileges to user
1
GRANT ALL ON my_db.* TO 'my_user'@'localhost';
Verify user GRANTS
1
SHOW GRANTS FOR my_user@localhost;