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’;

你可能感兴趣的:(MySQL,数据库,mysql,sql)