2012-04-15 18:53:39 -07:00
|
|
|
#!/bin/bash
|
2012-05-14 16:03:49 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2012-07-05 10:46:53 +01:00
|
|
|
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
|
|
|
|
|
2012-05-14 16:03:49 +02:00
|
|
|
cat << EOF | mysql -u root ${MYSQL_ROOT_PW_ARG}
|
|
|
|
DROP USER '${DATABASE}'@'localhost';
|
|
|
|
DROP USER '${DATABASE}'@'%';
|
|
|
|
DROP DATABASE ${DATABASE};
|
2012-04-15 18:53:39 -07:00
|
|
|
flush privileges;
|
|
|
|
EOF
|
|
|
|
|