From: clinton_admin Date: Sat, 25 Apr 2015 22:29:16 +0000 (-0400) Subject: mysql-grant-table-drop: quote database and table names X-Git-Url: https://git.hcoop.net/hcoop/scripts.git/commitdiff_plain/b7f2a6bb672f16862e7612946eab9c307b5cb8c0?hp=c1e3f8a218267459b38b99cb8260c994b02b3f3e mysql-grant-table-drop: quote database and table names Tables with '-' in their name broke the script. --- diff --git a/mysql-grant-table-drop b/mysql-grant-table-drop index 316f3e9..a70911d 100755 --- a/mysql-grant-table-drop +++ b/mysql-grant-table-drop @@ -24,7 +24,7 @@ for DB in $MYSQL_DBS; do for TBL in $MYSQLDB_TABLES; do #echo "OWNER FOR $DB.$TBL is $USER" - `sudo -H mysql -e "GRANT ALL PRIVILEGES ON $DB.$TBL TO $USER@'%.hcoop.net'"`; + sudo -H mysql -e "GRANT ALL PRIVILEGES ON \`$DB\`.\`$TBL\` TO $USER@'%.hcoop.net'"; done