mysql-grant-table-drop: quote database and table names
authorclinton_admin <clinton_admin@fritz.hcoop.net>
Sat, 25 Apr 2015 22:29:16 +0000 (18:29 -0400)
committerclinton_admin <clinton_admin@fritz.hcoop.net>
Sat, 25 Apr 2015 22:29:16 +0000 (18:29 -0400)
Tables with '-' in their name broke the script.

mysql-grant-table-drop

index 316f3e9..a70911d 100755 (executable)
@@ -24,7 +24,7 @@ for DB in $MYSQL_DBS; do
        for TBL in $MYSQLDB_TABLES; do
 
                #echo "OWNER FOR $DB.$TBL is $USER"
        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
 
 
        done