May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Categories

May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Mysql grant

 

Some mysql grant queries
Granting permission for a particular  DB only
mysql> grant all privileges on databasename.* to ‘username’@’localhost’;
mysql> flush privileges;

 

Granting Permission for all the DB
mysql> grant all privileges on *.* to ‘username’@’localhost’;

 

Granting Permission from a particular IP
# grant all privileges on *.* to ‘username’@’192.168.0.20’;

 

 # grant usage on *.* to bob@localhost identified by ‘passwd’;
# SHOW GRANTS FOR ‘admin’@’localhost’;

Granting selected privilages for user 

# grant select,insert,update,delete,create,drop on TestDb.* to ‘ctechz’@’localhost’ identified by ‘ctechz’;

 

 After creating the user give permission to him using grant
# create user username identified by ‘password’;
# GRANT ALL PRIVILEGES ON *.* TO ‘monty’@’%’ WITH GRANT OPTION;

— % means from all host.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>