Advertisement
Guest User

Untitled

a guest
Sep 21st, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. $dbh->exec("CREATE DATABASE `$db` CHARACTER SET utf8 COLLATE utf8_bin;
  2. CREATE USER '$user'@'%' IDENTIFIED BY '$pass';
  3. GRANT USAGE ON *.* TO '$db'@'localhost' IDENTIFIED BY PASSWORD '*3D3B92F242033365AE5BC6A8E6FC3E1679F4140A';
  4. GRANT ALL PRIVILEGES ON `$username_$dbusername`.* TO '$user'@'localhost';")
  5.  
  6. '*3D3B92F242033365AE5BC6A8E6FC3E1679F4140A'
  7.  
  8. test1234
  9.  
  10. $user='abc_dbuser';
  11. $db="abc_dbname";
  12. $pass='test1234';
  13. $dbusername="dbname";
  14. $username=get_current_user();
  15.  
  16. try {
  17. $dbh = new PDO("mysql:host=$host", $root, $root_password);
  18. $dbh->exec("CREATE DATABASE `$db` CHARACTER SET utf8 COLLATE utf8_bin;
  19. CREATE USER '$user'@'%' IDENTIFIED BY '$pass';
  20.  
  21. GRANT USAGE ON *.* TO '$db'@'localhost' IDENTIFIED BY PASSWORD '*3D3B92F242033365AE5BC6A8E6FC3E1679F4140A';
  22. GRANT ALL PRIVILEGES ON `$username_$dbusername`.* TO '$user'@'localhost';
  23. ")
  24. or die(print_r($dbh->errorInfo(), true));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement