Skip to content

Commit

Permalink
update addons/mysqladmin_shell.sh add INDEX privilege to GRANT
Browse files Browse the repository at this point in the history
  • Loading branch information
centminmod committed Nov 12, 2016
1 parent 3d252e8 commit 96fe4df
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions addons/mysqladmin_shell.sh
Expand Up @@ -101,7 +101,7 @@ fi

if [[ "$rootset" = [yY] && -f "$dbfile" ]]; then
while read -r db u p; do
mysql ${MYSQLOPTS} -e "CREATE DATABASE $db; CREATE USER '$u'@'$MYSQLHOSTNAME' IDENTIFIED BY '$p'; GRANT select, insert, delete, update, create, drop, alter, create temporary tables, execute, lock tables ON $db.* TO '$u'@'$MYSQLHOSTNAME'; flush privileges; show grants for '$u'@'$MYSQLHOSTNAME';"
mysql ${MYSQLOPTS} -e "CREATE DATABASE $db; CREATE USER '$u'@'$MYSQLHOSTNAME' IDENTIFIED BY '$p'; GRANT index, select, insert, delete, update, create, drop, alter, create temporary tables, execute, lock tables ON $db.* TO '$u'@'$MYSQLHOSTNAME'; flush privileges; show grants for '$u'@'$MYSQLHOSTNAME';"

ERROR=$?
if [[ "$ERROR" != '0' ]]; then
Expand Down Expand Up @@ -145,7 +145,7 @@ read -ep " Enter new MySQL database name: " newdbname
echo

if [[ "$rootset" = [yY] && "$createnewuser" = [yY] ]]; then
mysql ${MYSQLOPTS} -e "CREATE DATABASE $newdbname; CREATE USER '$newmysqluser'@'$MYSQLHOSTNAME' IDENTIFIED BY '$newmysqluserpass'; GRANT select, insert, delete, update, create, drop, alter, create temporary tables, execute, lock tables ON $newdbname.* TO '$newmysqluser'@'$MYSQLHOSTNAME'; flush privileges; show grants for '$newmysqluser'@'$MYSQLHOSTNAME';"
mysql ${MYSQLOPTS} -e "CREATE DATABASE $newdbname; CREATE USER '$newmysqluser'@'$MYSQLHOSTNAME' IDENTIFIED BY '$newmysqluserpass'; GRANT index, select, insert, delete, update, create, drop, alter, create temporary tables, execute, lock tables ON $newdbname.* TO '$newmysqluser'@'$MYSQLHOSTNAME'; flush privileges; show grants for '$newmysqluser'@'$MYSQLHOSTNAME';"

ERROR=$?
if [[ "$ERROR" != '0' ]]; then
Expand All @@ -159,7 +159,7 @@ if [[ "$rootset" = [yY] && "$createnewuser" = [yY] ]]; then
fi

elif [[ "$rootset" = [nN] && "$createnewuser" = [yY] ]]; then
mysql -e "CREATE DATABASE $newdbname; CREATE USER '$newmysqluser'@'$MYSQLHOSTNAME' IDENTIFIED BY '$newmysqluserpass'; GRANT select, insert, delete, update, create, drop, alter, create temporary tables, execute, lock tables ON $newdbname.* TO '$newmysqluser'@'$MYSQLHOSTNAME'; flush privileges; show grants for '$newmysqluser'@'$MYSQLHOSTNAME';"
mysql -e "CREATE DATABASE $newdbname; CREATE USER '$newmysqluser'@'$MYSQLHOSTNAME' IDENTIFIED BY '$newmysqluserpass'; GRANT index, select, insert, delete, update, create, drop, alter, create temporary tables, execute, lock tables ON $newdbname.* TO '$newmysqluser'@'$MYSQLHOSTNAME'; flush privileges; show grants for '$newmysqluser'@'$MYSQLHOSTNAME';"

ERROR=$?
if [[ "$ERROR" != '0' ]]; then
Expand All @@ -173,7 +173,7 @@ elif [[ "$rootset" = [nN] && "$createnewuser" = [yY] ]]; then
fi

elif [[ "$rootset" = [nN] && "$createnewuser" = [nN] ]]; then
mysql -e "CREATE DATABASE $newdbname; GRANT select, insert, delete, update, create, drop, alter, create temporary tables, execute, lock tables ON $newdbname.* TO '$existingmysqluser'@'$MYSQLHOSTNAME'; flush privileges; show grants for '$existingmysqluser'@'$MYSQLHOSTNAME';"
mysql -e "CREATE DATABASE $newdbname; GRANT index, select, insert, delete, update, create, drop, alter, create temporary tables, execute, lock tables ON $newdbname.* TO '$existingmysqluser'@'$MYSQLHOSTNAME'; flush privileges; show grants for '$existingmysqluser'@'$MYSQLHOSTNAME';"

ERROR=$?
if [[ "$ERROR" != '0' ]]; then
Expand All @@ -187,7 +187,7 @@ elif [[ "$rootset" = [nN] && "$createnewuser" = [nN] ]]; then
fi

elif [[ "$rootset" = [yY] && "$createnewuser" = [nN] ]]; then
mysql ${MYSQLOPTS} -e "CREATE DATABASE $newdbname; GRANT select, insert, delete, update, create, drop, alter, create temporary tables, execute, lock tables ON $newdbname.* TO '$existingmysqluser'@'$MYSQLHOSTNAME'; flush privileges; show grants for '$existingmysqluser'@'$MYSQLHOSTNAME';"
mysql ${MYSQLOPTS} -e "CREATE DATABASE $newdbname; GRANT index, select, insert, delete, update, create, drop, alter, create temporary tables, execute, lock tables ON $newdbname.* TO '$existingmysqluser'@'$MYSQLHOSTNAME'; flush privileges; show grants for '$existingmysqluser'@'$MYSQLHOSTNAME';"

ERROR=$?
if [[ "$ERROR" != '0' ]]; then
Expand Down

0 comments on commit 96fe4df

Please sign in to comment.