工作需要,要将所有的mysql表的引擎改为innodb
执行如下SQL
SET @DATABASE_NAME = 'name_of_your_db';SELECT CONCAT('ALTER TABLE `', table_name, '` ENGINE=InnoDB;') AS sql_statementsFROM information_schema.tables AS tbWHERE table_schema = @DATABASE_NAMEAND `ENGINE` = 'MyISAM'AND `TABLE_TYPE` = 'BASE TABLE'ORDER BY table_name DESC;
将查询得到的结果复制出来作为新的SQL执行即可