查看mysql数据库占用磁盘空间

select table_schema as ‘数据库’,sum(table_rows) as ‘记录数’, sum(truncate(data_length/1024/1024, 2)) as ‘数据容量(MB)’, sum(truncate(index_length/1024/1024, 2)) as ‘索引容量(MB)’ from information_schema.tables where taable_schema=’ nlp_custodian’;

+---------------+-----------+------------------+------------------+
| 数据库        | 记录数    | 数据容量(MB)     | 索引容量(MB)     |
+---------------+-----------+------------------+------------------+
| nlp_custodian |    345328 |           160.00 |            12.03 |
+---------------+-----------+------------------+------------------+


你可能感兴趣的:(mysql)