1、查看指定库的大小
use information_schema;
select concat(round(sum(data_length/1024/1024),2),'mb') as data from tables where table_schema='testdb';
2、查看指定表的大小
select concat(round(sum(data_length/1024/1024),2),'mb') as data from tables where table_schema='testdb' and table_name='test';
3、查看所有表的大小
select data_length/1024/1024,table_name as data from tables where table_schema='testdb';