Guest User

Untitled

a guest
Aug 5th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. set -e
  4.  
  5. PASS=`pwgen -s 40 1`
  6.  
  7. mysql -uroot <<MYSQL_COMM
  8.  
  9. CREATE DATABASE $1;
  10.  
  11. CREATE USER '$1'@'localhost' IDENTIFIED BY '$PASS';
  12.  
  13. GRANT ALL PRIVILEGES ON $1.* TO '$1'@'localhost';
  14.  
  15. FLUSH PRIVILEGES;
  16.  
  17. MYSQL_COMM
  18.  
  19. echo "MySQL user created."
  20.  
  21. echo "Username: $1"
  22.  
  23. echo "Password: $PASS"
Add Comment
Please, Sign In to add comment