\! rm -f /tmp/ivan_alter.sql #预删除临时文件,方式下面的语句无法写入
SELECT concat(‘alter table `’, TABLE_SCHEMA, ‘`.`’, TABLE_NAME, ‘` engine=innodb;’)
FROM information_schema.TABLES
WHERE ENGINE=‘Myisam’ AND
TABLE_SCHEMA<>‘mysql’ AND
TABLE_SCHEMA<>‘information_schema’
INTO OUTFILE ‘/tmp/ivan_alter.sql’ ;
source /tmp/ivan_alter.sql
\! rm -f /tmp/ivan_alter.sql #执行完后删除临时文件
INNODB类型数据状态下,
mysql会用目录下的ibdata文件用来储存数据库数据
而库名的文件夹里面的那些表文件只是表结构而已,所以打包备份要注意备份ibdata*
http://www.mysqlab.net/blog/2009/04/mysql51-master%E4%B8%8A%E6%89%B9%E9%87%8F%E5%B0%86myisam%E5%BC%95%E6%93%8E%E8%BD%ACinnodb/