Login to your MySQL root
account (or any other account with admin privileges):
mysql -u root -p
Create the database you want your new user to be associated with:
CREATE DATABASE example_database;
Create the new user:
CREATE USER 'example_user'@'localhost' IDENTIFIED BY 'password';
Grant the new user access to the newly created database:
GRANT ALL ON example_database.* TO 'example_user'@'localhost';
Login to MySQL with your new user:
mysql -u example_user -p
Check the databases under the new user:
show databases;
Build something awesome!
Top comments (0)