Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dbuser=user
- dbpass=pass
- #STEP 1 - CREATE DB
- #check if db exists first
- echo "Creating a database for $newdb"
- DBS=`mysql -u$dbuser -p$dbpass -Bse 'show databases'| egrep -v 'information_schema|mysql'`
- for db in $DBS; do
- if [ "$db" = "$newdb" ]
- then
- echo "This database already exists : exiting now"
- exit
- fi
- done
- mysqladmin -u$dbuser -p$dbpass create $newdb;
- echo "Database $newdb created"
Add Comment
Please, Sign In to add comment