1.查看当前数据引擎的命令:
show engines;
2.拼接修改语句
SELECT GROUP_CONCAT(CONCAT('ALTER TABLE',TABLE_NAME,'ENGINE=InnoDB;') SEPARATOR '')
FROM information_schema.TABLES AS t
WHERE TABLE_SCHEMA = '数据库名称' AND TABLE_TYPE = 'BASE TABLE';
执行后其实生成的是查询命令,然后copy生产的命令,执行SQL 即可:
ALTER TABLE info_aaaa ENGINE=InnoDB; ALTER TABLE info_data_bbb ENGINE=InnoDB; ALTER TABLE info_data_ccc ENGINE=InnoDB; ALTER TABLE info_data_ddd ENGINE=InnoDB; ALTER TABLE info_data_eee ENGINE=InnoDB; ALTER TABLE info_data_fffENGINE=InnoDB;
再次查看数据表的数据引擎已经更改了:show table status from 数据库名称;