How to provide full permissions on a database to user in MySQL Server - MySQL DBA Tutorial

How to provide full permissions to user in MySQL Database

To provide full permissions on a Database to user in MySQL Server, you will be using below syntax.

Syntax:
MySQL > GRANT ALL ON DatabaseName.* TO 'UserName'@'Host' WITH GRANT OPTION;

WITH GRANT OPTION, user will be able to provide permissions to other users on the database. If you don't want that then remove the "With GRANT OPTION" from above statement.


Example:
 
Let's create user TB and provide full permissions on Database name "TechBrothers" , We also want the TB user to have permissions to GRANT permissions on "TechBrothers" databases to other users.
MySQL > Create User 'TB'@'localhost' Identified by "Password123";

Grant full permissions on TechBrothers Databases to user account TB.

MySQL > GRANT ALL ON TechBrothers.* TO 'TB'@'localhost' With GRANT OPTION; 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.