MySQL – Create new user and GRANT access to the database

GRANT access to the database of a particular user At command line issue:

mysql -u root -p

Now create “myuser” user and password. Give rights/privileges to that user on database “mydatabase”.

Last but not least, run flush command to reload all the privileges.

1. CREATE USER ‘myuser’@’localhost’ IDENTIFIED BY ‘mypassword’;

2. GRANT ALL PRIVILEGES ON mydatabase . * TO ‘myuser’@’localhost’;

3. FLUSH PRIVILEGES;