工作需要,要将所有的mysql表的引擎改为innodb
执行如下SQL
SET @DATABASE_NAME = ‘name_of_your_db‘;
SELECT CONCAT(‘ALTER TABLE `‘, table_name, ‘` ENGINE=InnoDB;‘) AS sql_statements
FROM information_schema.tables AS tb
WHERE table_schema = @DATABASE_NAME
AND `ENGINE` = ‘MyISAM‘
AND `TABLE_TYPE` = ‘BASE TABLE‘
ORDER BY table_name DESC;
将查询得到的结果复制出来作为新的SQL执行即可
时间: 2024-10-16 06:40:36