MYSQL 数据库查看磁盘占用情况

查看 mysql 每个数据库磁盘占用情况

select TABLE_SCHEMA, concat(truncate(sum(data_length)/1024/1024,2),' MB') as data_size,
concat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size
from information_schema.tables
group by TABLE_SCHEMA
order by data_size desc;

查看数据库实例所有数据库磁盘占用情况

select concat(truncate(sum(data_length)/1024/1024,2),' MB') as data_size from information_schema.tables;

查询指定数据库磁盘占用情况

select concat(truncate(sum(data_length)/1024/1024,2),’ MB’) as data_size from information_schema.tables where table_schema=‘information_schema’;

    原文作者:御剑长歌
    原文地址: https://blog.csdn.net/weixin_40392053/article/details/125515124
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞