在MySQL中通过引擎显示表

我将如何显示MySQL中的所有表与给定的引擎,例如InnoDB,MyISAM,FEDERATED?

使用INFORMATION_SCHEMA.TABLES表:

 SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE engine = 'InnoDB' 

如果你想要一个数据库的结果

 SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'dbname' AND engine = 'InnoDB'; 

其他例子在这里。

所有引擎表(系统表除外):

 SELECT TABLE_SCHEMA as DbName ,TABLE_NAME as TableName ,ENGINE as Engine FROM information_schema.TABLES WHERE ENGINE = 'MyISAM' -- or InnoDB or whatever AND TABLE_SCHEMA NOT IN('mysql','information_schema','performance_schema'); 

除引擎以外的所有表(系统表除外):

 SELECT TABLE_SCHEMA as DbName ,TABLE_NAME as TableName ,ENGINE as Engine FROM information_schema.TABLES WHERE ENGINE != 'MyISAM' -- or InnoDB or whatever AND TABLE_SCHEMA NOT IN('mysql','information_schema','performance_schema'); 

如果有一些有问题,并希望看到哪个DB是具有特定引擎的表

 SELECT (SELECT group_concat(TABLE_NAME) FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'database1' AND engine = 'MyIsam' ) as database1, (SELECT group_concat(TABLE_NAME) FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'database2' AND engine = 'MyIsam' ) as database2, (SELECT group_concat(TABLE_NAME) FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'database3' AND engine = 'MyIsam' ) as database3; 

问候。