Created
March 23, 2013 06:28
-
-
Save chrisl8888/5226686 to your computer and use it in GitHub Desktop.
Create mysql database script
This file contains hidden or 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 | |
# Help from http://drupal.org/documentation/install/create-database | |
echo '--------------------------------------------' | |
echo ' Create a database' | |
echo '--------------------------------------------' | |
echo ' | |
' | |
echo 'Please enter a username to create for this new database:' | |
read UN | |
echo "Please provide a password for $UN" | |
read NUPW | |
echo 'Provide a database name' | |
read DB | |
echo '... You'll be prompted for root password' | |
mysql -uroot -p -e "create database $DB; create user '$UN'@'localhost' identified by '$NUPW'; grant all on $DB.* to '$UN'@'localhost' identified by $NUPW; flush privileges;" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment