mysql

warning: Creating default object from empty value in /var/www/www.jonno.org/htdocs/drupal/modules/taxonomy/taxonomy.pages.inc 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;"

MySQL: count tables by Schema and Storage Engine

select table_schema, engine, count(*) from information_schema.tables where table_schema not in ('mysql', 'information_schema', 'test') group by table_schema, engine;

+--------------+--------+----------+
| table_schema | engine | count(*) |
+--------------+--------+----------+
| gallery2     | InnoDB |       56 | 
| gallery2     | MyISAM |        2 | 
| foo          | NULL   |        1 | 
| foo          | InnoDB |        3 | 
| foo          | MyISAM |        1 | 
+--------------+--------+----------+
Syndicate content