logo

MySQL - Create new user and GRANT access to the database

Date: 2015-11-05

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

Code:

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.

Code:

CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword';


2.

Code:

GRANT ALL PRIVILEGES ON mydatabase . * TO 'myuser'@'localhost';


3.

Code:

FLUSH PRIVILEGES;

ubuntudog.com © 2017 | About | Sitemap | Contact