4 # This script finds all tables in all databases and grants DROP permission
5 # on DBNAME.TBLNAME to corresponding DB owners.
6 # We have to do this because granting DROP on DBNAME.* also gives permission
7 # to drop DBNAME itself, which we can't allow.
9 # docelic@hcoop.net, Mon Sep 24 16:25:34 EDT 2007
12 # Exit for now; I don't know how to handle this without messing up
15 MYSQL_DBS
=`sudo -H mysqlshow | tail -n +4 | head -n -1 | cut -d' ' -f 2 | xargs`
16 #echo "Mysql Databases are: $MYSQL_DBS"
18 for DB
in $MYSQL_DBS; do
19 if test "$DB" != "information_schema"; then
20 if test "$DB" != "mysql"; then
23 MYSQLDB_TABLES
=`sudo -H mysqlshow $DB | tail -n +5 | head -n -1 | cut -d' ' -f 2 | xargs`
24 #echo Tables in $DB are $MYSQLDB_TABLES
25 for TBL
in $MYSQLDB_TABLES; do
27 #echo "OWNER FOR $DB.$TBL is $USER"
28 `sudo -H mysql -e "GRANT ALL PRIVILEGES ON $DB.$TBL TO $USER@'%.hcoop.net'"`;
32 fi # information_schema