Tag Archive: mysql

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
CREATE USER 'my_user'@'localhost' IDENTIFIED BY 'my_pass';
Verify user
SELECT * FROM mysql.user WHERE User = 'my_user'G
Grant privileges to user
GRANT ALL ON my_db.* TO 'my_user'@'localhost';
Verify user GRANTS
SHOW GRANTS FOR my_user@localhost;