mk-find - 找到指定表,并批量执行操作。安装方法可以参考这里。
如果你想批量的执行一系列命令,例如我想把TEST库所有的myisam表都Optimize下,以前你可能会使用这样的方法:

mysql -u sg -p’xxxx’ -e "select concat(’optimize table ‘,table_schema,’.',table_name,’;')
into outfile ‘/u01/data/opti.sql’ from information_schema.tables where ENGINE=’MyISAM’ and table_schema=’TEST’;"
 
cat /u01/data/opti.sql
optimize table test.test;
optimize table test.test2;
optimize table test.zzz;
 
mysql -u sg -p’xxxx’ < /u01/data/opti.sql
test.test optimize status OK
Table Op [...]