https://dev.mysql.com/doc/refman/5.7/en/information-schema.html
利用 information_schema 可以做很多事,这个库存储了mysql的元数据!
比如:
1)查询存在哪些 表是 innodb 的
2)查询 innodb 表的大小
3)查询某字段的定义
例子
SELECT table_schema,table_name, table_rows,
ROUND((data_length+index_length)/1024/1024) AS total_mb,
ROUND(data_length/1024/1024) AS data_mb,
ROUND(index_length/1024/1024) AS index_mb
FROM INFORMATION_SCHEMA.TABLES WHERE engine=’InnoDB’
ORDER BY total_mb desc;