Skip to content

grant user access to specific database

Rayhan Uddin edited this page Oct 3, 2017 · 1 revision
     mysql> CREATE USER 'custom'@'localhost' IDENTIFIED BY 'obscure';
    mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
     ->     ON bankaccount.*
    ->     TO 'custom'@'localhost';
   mysql> CREATE USER 'custom'@'host47.example.com' IDENTIFIED BY 'obscure';
   mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
   ->     ON expenses.*
    ->     TO 'custom'@'host47.example.com';
 mysql> CREATE USER 'custom'@'%.example.com' IDENTIFIED BY 'obscure';
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
  ->     ON customer.*
 ->     TO 'custom'@'%.example.com';
Clone this wiki locally