From 3baebe130045747aafad52c8e97e499db3fb6a6a Mon Sep 17 00:00:00 2001 From: Christoph Date: Mon, 10 Sep 2018 15:52:26 +0200 Subject: [PATCH] create_database.sh: remove giving Super_priv to created user.. --- create_database.sh | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/create_database.sh b/create_database.sh index 3664493..8e23487 100755 --- a/create_database.sh +++ b/create_database.sh @@ -463,9 +463,19 @@ if [[ $MAJOR_VERSION -gt 8 ]] \ else - echononl " Grant full access to user '$DATABASE_USER' on Database '$DATABASE_NAME'" + echononl " Grant usage to user '$DATABASE_USER' (Creates User..)" mysql $MYSQL_CREDENTIAL_ARGS -N -s -e \ - "GRANT ALL ON ${DATABASE_NAME}.* TO '$DATABASE_USER'@'localhost' IDENTIFIED BY '$DATABASE_PASSWD'" > $tmp_log_file 2>&1 + "GRANT USAGE ON *.* TO '$DATABASE_USER'@'localhost' IDENTIFIED BY '$DATABASE_PASSWD'" > $tmp_log_file 2>&1 + if [[ $? -ne 0 ]] ; then + echo_failed + error "$(cat $tmp_log_file)" + else + echo_ok + fi + + echononl " Grant all privileges to user '$DATABASE_USER' on Database '$DATABASE_NAME'" + mysql $MYSQL_CREDENTIAL_ARGS -N -s -e \ + "GRANT ALL PRIVILEGES ON ${DATABASE_NAME}.* TO '$DATABASE_USER'@'localhost'" > $tmp_log_file 2>&1 if [[ $? -ne 0 ]] ; then echo_failed error "$(cat $tmp_log_file)" @@ -475,15 +485,15 @@ else fi # if [[ $MAJOR_VERSION -ge 8 ]] -echononl " Also grant 'Super_priv' privilege to '$DATABASE_USER' on Database '$DATABASE_NAME'" -mysql $MYSQL_CREDENTIAL_ARGS -N -s -e \ - "USE mysql; UPDATE user SET Super_priv = 'Y' WHERE User = '$DATABASE_USER'" > $tmp_log_file 2>&1 -if [[ $? -ne 0 ]] ; then - echo_failed - error "$(cat $tmp_log_file)" -else - echo_ok -fi +#echononl " Also grant 'Super_priv' privilege to '$DATABASE_USER' on Database '$DATABASE_NAME'" +#mysql $MYSQL_CREDENTIAL_ARGS -N -s -e \ +# "USE mysql; UPDATE user SET Super_priv = 'Y' WHERE User = '$DATABASE_USER'" > $tmp_log_file 2>&1 +#if [[ $? -ne 0 ]] ; then +# echo_failed +# error "$(cat $tmp_log_file)" +#else +# echo_ok +#fi echononl " Flush Privileges.." mysql $MYSQL_CREDENTIAL_ARGS -N -s -e "FLUSH PRIVILEGES" > $tmp_log_file 2>&1