You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
660 B
33 lines
660 B
#!/bin/bash |
|
|
|
DATABASE=heat |
|
|
|
while [ $# -gt 0 ]; do |
|
case $1 in |
|
heat|nova|keystone|glance) |
|
DATABASE=$1 |
|
;; |
|
-r|--rootpw) |
|
shift |
|
MYSQL_ROOT_PW_ARG="--password=$1" |
|
;; |
|
*) |
|
;; |
|
esac |
|
shift |
|
done |
|
|
|
if [ ! "${MYSQL_ROOT_PW_ARG+defined}" ] ; then |
|
printf "Please enter the password for the 'root' MySQL user: " |
|
read -s MYSQL_ROOT_PW |
|
MYSQL_ROOT_PW_ARG="--password=${MYSQL_ROOT_PW}" |
|
echo |
|
fi |
|
|
|
cat << EOF | mysql -u root ${MYSQL_ROOT_PW_ARG} |
|
DROP USER '${DATABASE}'@'localhost'; |
|
DROP USER '${DATABASE}'@'%'; |
|
DROP DATABASE ${DATABASE}; |
|
flush privileges; |
|
EOF |
|
|
|
|