Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #! /bin/bash
  2.  
  3. newUser='testuser'
  4. newDbPassword='testpwd'
  5. newDb='testdb'
  6. host=localhost
  7. #host='%'
  8.  
  9. commands="CREATE DATABASE \`${newDb}\`;CREATE USER '${newUser}'@'${host}' IDENTIFIED BY '${newDbPassword}';GRANT USAGE ON *.* TO '${newUser}'@'${host}' IDENTIFIED BY '${newDbPassword}';GRANT ALL privileges ON \`${newDb}\`.*
  10. TO '${newUser}'@'${host}';FLUSH PRIVILEGES;"
  11.  
  12. echo "${commands}" | /usr/bin/mysql -u root -p
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement