标题:mysql显示一个数据库中所有的表占用的空间大小

发表于

SELECT
table_schema AS '数据库',
table_name AS '表名',
table_rows AS '记录数',
TRUNCATE (data_length / 1024 / 1024, 2) AS '数据容量(MB)',
TRUNCATE (index_length / 1024 / 1024, 2) AS '索引容量(MB)'
FROM
information_schema. TABLES
WHERE
table_schema = 'mydb'      ---- 这个mydb需要修改,请填写真实的数据库名字
ORDER BY
table_rows DESC;