warning: Creating default object from empty value in /var/www/ on line 33.

mysql grant subqueries

MySQL doesn't allow subqueries inside GRANT statements (only inside SELECT, INSERT, UPDATE, DELETE, SET, or DO). Here's a workaround using bash, when you want to grant based on a wildcard pattern in the schema name:

mysql -e "grant select on $(mysql -N -e "select distinct table_schema from information_schema.tables where table_schema like 'foo%';").* to user@host;"

Syndicate content