假定要查的数据库名称是“xxxx_mall”
1、查看数据库数据占用大小
select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from information_schema.TABLES where table_schema='xxxx_mall'
2、查看数据库索引占用大小
select concat(round(sum(INDEX_LENGTH/1024/1024),2),'MB') as data from information_schema.TABLES where table_schema='xxxx_mall'
3、查看数据库各个表的行数,索引大小,数据大小
select table_name,table_rows,concat(round((index_length)/1024/1024,2),'MB') index_data ,concat(round((data_length)/1024/1024,2),'MB') data_data
from information_schema.TABLES where table_schema='xxxx_mall'
4、查看各个数据库的表个数
select count(*) tables, table_schema from information_schema.tables group by table_schema