如何使用给定的引擎显示 MySQL 中的所有表,例如 InnoDB、MyISAM、FEDERATED?
问问题
68414 次
4 回答
136
SELECT table_name FROM INFORMATION_SCHEMA.TABLES
WHERE engine = 'InnoDB'
于 2009-11-11T21:20:21.107 回答
81
如果您想要来自单个数据库的结果
SELECT TABLE_NAME FROM information_schema.TABLES
WHERE TABLE_SCHEMA = 'dbname' AND engine = 'InnoDB';
于 2012-09-06T05:01:01.473 回答
6
这里的其他例子。
引擎的所有表(系统表除外):
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');
于 2017-06-20T12:31:49.513 回答
1
如果有些人有问题并想查看哪个数据库是具有特定引擎的表
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;
问候。
于 2016-11-26T09:04:23.053 回答