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='DATABASENAME';


查看指定数据库的某个表的大小:

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