Posted By

isholgueras on 11/16/10


Tagged

mysql


Versions (?)

Create MySQL users for any domain or server


 / Published in: SQL
 

Creating users in MySQL.

  1. ;Create a new user named "myuserinlocalhost" only FOR localhost WITH the password "passwordinlocalhost"
  2. CREATE USER 'myuserinlocalhost'@'localhost' IDENTIFIED BY 'passwordinlocalhost';
  3.  
  4. ;Create a new user name "myuserforanydomain" FOR any domain but localhost WITH the password "otherpassword"
  5. CREATE USER 'myuserforanydomain'@'%' IDENTIFIED BY 'otherpassword';
  6.  
  7. ;Create a new user name "myuserforanydomain" FOR only 172.22.200.133 IP WITH the password "otherpassword"
  8. CREATE USER 'myuserforanydomain'@'172.22.200.133' IDENTIFIED BY 'otherpassword';
  9.  
  10. ;Grant privileges TO an user
  11. GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON npblog_db.* TO 'npblog_sch_db'@'localhost' IDENTIFIED BY 'password';
  12.  
  13. ;refresh
  14. FLUSH privileges;

Report this snippet  

You need to login to post a comment.