Created
March 20, 2015 00:56
-
-
Save remoteur/70ffa33f234a4b8fa00c to your computer and use it in GitHub Desktop.
db_create
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
db=$1 | |
pass=$(openssl rand -hex 10) | |
mysql -e "CREATE DATABASE $1" | |
mysql -e "GRANT ALL PRIVILEGES ON $db.* TO '$db'@'localhost' IDENTIFIED BY '$pass';" | |
mysql -e "GRANT ALL PRIVILEGES ON $db.* TO '$db'@'%' IDENTIFIED BY '$pass';" | |
echo $pass > .$db |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment