##1. 没有主键,innodb自动创建的主键,innodb_sys_indexes
表name列记录为GEN_CLUST_INDEX
SELECT t.name AS table_name, t.space, t.file_format, t.row_format, t.space_typeFROM information_schema.INNODB_SYS_TABLES AS t, information_schema.INNODB_SYS_INDEXES AS iWHERE t.table_id = i.table_id AND t.space = i.space AND t.name NOT LIKE 'SYS%' AND t.name NOT LIKE 'mysql%' AND i.name = 'GEN_CLUST_INDEX';
- 5.6,INNODB_SYS_TABLES没有
space_type
列
2. 通过tables和columns表进行检索
SELECT table_schema, table_nameFROM information_schema.TABLESWHERE (table_schema , table_name) NOT IN (SELECT DISTINCT table_schema, TABLE_NAME FROM information_schema.COLUMNS WHERE COLUMN_KEY = 'PRI') AND table_schema NOT IN ('mysql' , 'information_schema', 'sys', 'performance_schema');