最新消息: 新版网站上线了!!!

mysql innodb myisam 表格式互转

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;
.....

转载请注明:谷谷点程序 » mysql innodb myisam 表格式互转