Skip to content
Browse files

Merge pull request #1 from migue/master

Shell script to recreate (drop and create) a MySQL schema
  • Loading branch information...
2 parents 32d2f8c + 2690160 commit 223552ea4443970638f88445aa0a3da5fb8c7c77 @almonwork almonwork committed
Showing with 19 additions and 0 deletions.
  1. +19 −0 database/dropDatabase.sh
View
19 database/dropDatabase.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+MUSER="$1"
+MPASS="$2"
+MDB="$3"
+
+# Detect the paths for the MySQL command
+MYSQL=$(which mysql)
+
+if [ $# -ne 3 ]
+then
+ echo "Usage: $0 {MySQL-User-Name}{MySQL-Password}{MySQL-Database-Name}"
+ echo "Deletes and (re) create the indicated database"
+ exit 1
+fi
+
+echo "Deleting database $MDB ..."
+$MYSQL -u $MUSER -p$MPASS -e "DROP SCHEMA $MDB"
+echo "Creating the schema $MDB . . ."
+$MYSQL -u $MUSER -p$MPASS -e "CREATE SCHEMA $MDB DEFAULT CHARACTER SET utf8 ;"

0 comments on commit 223552e

Please sign in to comment.
Something went wrong with that request. Please try again.