innodb 转换为 myisam
SELECT CONCAT('ALTER TABLE ', table_name, ' ENGINE=MyISAM;') AS sql_statements INTO OUTFILE '/tmp/result.txt'
FROM information_schema.tables AS tb
WHERE table_schema = 'TableName'
AND `ENGINE` = 'InnoDB'
AND `TABLE_TYPE` = 'BASE TABLE'
ORDER BY table_name DESC;
source /tmp/result.txt;
myisam 转换为 innodb
SELECT CONCAT('ALTER TABLE ', table_name, ' ENGINE=InnoDB;') AS sql_statements INTO OUTFILE '/tmp/result.txt'
FROM information_schema.tables AS tb
WHERE table_schema = 'TableName'
AND `ENGINE` = 'MyISAM'
AND `TABLE_TYPE` = 'BASE TABLE'
ORDER BY table_name DESC;
source /tmp/result.txt;