我们目的是都改为innodb
所以先查找一下所有非innodb的表:
select table_catalog
,table_schema
,table_name
,engine
from information_schema.tables
where engine<>'InnoDB'
and table_schema not in ('mysql','information_schema','performance_schema');
利用字符串拼接语句:
select concat('alter table ',table_name,' engine=innodb;')
from information_schema.tables
where engine <> 'InnoDB'
and table_schema = '库名';
然后将结果集复制出来执行即可
网友评论