used wrong variable, changed output
This commit is contained in:
parent
c452d9863c
commit
7e83e39db2
1 changed files with 4 additions and 4 deletions
|
|
@ -463,7 +463,7 @@ while true; do
|
||||||
while [[ $FINISHED == false ]]; do
|
while [[ $FINISHED == false ]]; do
|
||||||
echo -e "${YELLOW}Enter name of the Database, you want to create:${NC}"
|
echo -e "${YELLOW}Enter name of the Database, you want to create:${NC}"
|
||||||
read DB
|
read DB
|
||||||
if [[ ! -z "`mysql -qfsBe "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='${DB}'" &> /dev/null`" ]]; then
|
if [[ ! -z "`mysql -qfsBe "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='${DB}'" 2>&1`" ]]; then
|
||||||
echo
|
echo
|
||||||
echo -e "${RED}Database already exists!"
|
echo -e "${RED}Database already exists!"
|
||||||
echo -e "Should I drop it and recreate? Attention: All data will be lost and can not be recovered!${NC}"
|
echo -e "Should I drop it and recreate? Attention: All data will be lost and can not be recovered!${NC}"
|
||||||
|
|
@ -511,7 +511,7 @@ while true; do
|
||||||
read -p "(y/n): " SURE
|
read -p "(y/n): " SURE
|
||||||
case $SURE in
|
case $SURE in
|
||||||
[Yy]* )
|
[Yy]* )
|
||||||
if [[ ! -z "`mysql -qfsBe "SELECT User FROM mysql.user WHERE User = '${USER}'" &>/dev/null`" ]];
|
if [[ ! -z "`mysql -qfsBe "SELECT User FROM mysql.user WHERE User = '${USER}'" 2>&1`" ]];
|
||||||
then
|
then
|
||||||
echo
|
echo
|
||||||
echo -e "${RED}User already exists!"
|
echo -e "${RED}User already exists!"
|
||||||
|
|
@ -520,8 +520,8 @@ while true; do
|
||||||
read -p "(recreate/keep): " SURE
|
read -p "(recreate/keep): " SURE
|
||||||
case $SURE in
|
case $SURE in
|
||||||
[recreate]* )
|
[recreate]* )
|
||||||
mysql -e "DROP USER ${DB}@'localhost';"
|
mysql -e "DROP USER ${USER}@'localhost';"
|
||||||
mysql -e "CREATE USER ${DB}@localhost IDENTIFIED BY '${USERPW}';"
|
mysql -e "CREATE USER ${USER}@localhost IDENTIFIED BY '${USERPW}';"
|
||||||
mysql -e "GRANT ALL PRIVILEGES ON ${DB}.* TO '${USER}'@'localhost';"
|
mysql -e "GRANT ALL PRIVILEGES ON ${DB}.* TO '${USER}'@'localhost';"
|
||||||
mysql -e "FLUSH PRIVILEGES;"
|
mysql -e "FLUSH PRIVILEGES;"
|
||||||
echo -e "${GREEN}Recreated User ${USER}."
|
echo -e "${GREEN}Recreated User ${USER}."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue