Date posted : 23/01/2019

Create a New User and Grant Permissions in MySQL

MySQL

MySQL, the most popular Open Source SQL database management system, is developed, distributed, and supported by Oracle Corporation.

Step 1: A new user can be created within the MySQL shell, using the following statement:

CREATE USER 'pheonix'@'localhost' IDENTIFIED BY 'password';

This will create a new user named ‘pheonix’ without any permissions.

Step 2: To give full access to all databases for the pheonix user, run the following statement:

GRANT ALL PRIVILEGES ON * . * TO 'pheonix'@'localhost';

Step 3:Then run following statement to reload all the privileges:

FLUSH PRIVILEGES;

Step 4: To give access to a specific database for the new user, run the following statement:

GRANT ALL PRIVILEGES ON database . * TO 'pheonix'@'localhost';

Step 5: To revoke access:

REVOKE ALL PRIVILEGES ON database.* FROM 'pheonix'@'localhost';

Thank you! for using PHEONIX SOLUTIONS.

You find this tutorial helpful? Share with your friends to keep it alive. Be the first to comment, we value your suggestions. For further queries please comment below.


Leave a Reply