查看一张指定表的索引信息
点击查看代码
show index from tablename;
查询某个数据库(table_schema)的全部表索引
点击查看代码
-- 排除主键索引
select TABLE_NAME, INDEX_NAME, GROUP_CONCAT(COLUMN_NAME) as INDEX_COLUMN
from
information_schema.statistics
where
table_schema='库名' and INDEX_NAME <> 'PRIMARY'
GROUP BY TABLE_NAME, INDEX_NAME;