How to Grant Full Permission on a Database to a User in MariaDB

How to Grant Full Permission on a Database to a User in MariaDB

To provide full permissions on a database to user, you will be using below syntax.

Syntax:
MariaDB > 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.
MariaDB > Create User 'TB'@'localhost' Identified by "Password123";

Grant full permissions on TechBrothers Databases to user account TB.

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


MariaDB Tutorial step by step for beginners - Grant permission on database to user 

1 comment: