Mysql查看数据量

任何查询均需进入information_schema数据库,命令

use information_schema;

1,查看总数据量

select concat(round(sum(data_length/1024/1024),2),’MB’) as data from tables;

2,查看某个数据库的数据量,此处为data数据库

select concat(round(sum(data_length/1024/1024),2),’MB’) as data from tables where table_schema=’data’;

3,查看某个表的数据量,此处为data数据库中的storage表

select concat(round(sum(data_length/1024/1024),2),’MB’) as data from tables where table_schema=’data’ and table_name=’storage’;

本文链接地址: https://danteng.org/mysql-data-storage/