Tuesday, April 19, 2022

Granting a user in MySQL

Granting a user in MySQL


Examples on GRANT command


grant all privileges on *.* to 'user_name'@'localhost';

grant all privileges on *.* to 'user_name'@'%';

grant all privileges on *.* to 'user_name'@'localhost' with grant option;

grant all privileges on *.* to 'user_name'@'%' with grant option;


grant all privileges on dbname.* to 'user_name'@'localhost';

grant all privileges on dbname.* to 'user_name'@'%';


grant insert,update,delete on table dbname.tablename to 'user_name'@'localhost';

grant insert,update,delete on table dbname.tablename to 'user_name'@'%';


grant create on database.* to 'user_name'@'localhost';

grant create on database.* to 'user_name'@'%';


grant select , execute on database.* to 'user_name'@'%';

grant select , execute on database.* to 'user_name'@'localhost'; 

No comments:

Post a Comment