## 进入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 concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='home' and table_name='members';
## 统计表使用空间
select concat(round(sum(data_length/1024/1024),2),'mb') as data from tables where table_schema='mydb' and table_name='mytable';
## 统计数据库使用空间
select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='mydb';
## 统计所有数据使用空间
select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables;