Guest User

Untitled

a guest
Dec 23rd, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. dbuser=user
  2. dbpass=pass
  3. #STEP 1 - CREATE DB
  4. #check if db exists first
  5. echo "Creating a database for $newdb"
  6. DBS=`mysql -u$dbuser -p$dbpass -Bse 'show databases'| egrep -v 'information_schema|mysql'`
  7. for db in $DBS; do
  8. if [ "$db" = "$newdb" ]
  9. then
  10. echo "This database already exists : exiting now"
  11. exit
  12. fi
  13. done
  14. mysqladmin -u$dbuser -p$dbpass create $newdb;
  15. echo "Database $newdb created"
Add Comment
Please, Sign In to add comment