进入information_schema 数据库(存放了其他的数据库的信息)
use information_schema;
查询所有数据的大小:
select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables;
查看指定数据库的大小:
select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='home';
查看指定数据库每张表的大小
select table_name,concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='qingting' group by table_name order by data desc;