查询数据库中表数量和各表中数据量

 

1.查询某个数据库下有多少张表

SELECT COUNT(*) TABLES FROM information_schema.TABLES WHERE table_schema = '替换成你的数据库名';

 

2.查询某个数据库下每个表有多少条数据

select TABLE_NAME, concat(truncate(data_length/1024/1024,2),' MB') as data_size,table_rows
from information_schema.tables where TABLE_SCHEMA = '替换成你的数据库名';
posted @ 2019-12-25 15:13  [浪子回头]  阅读(5912)  评论(0编辑  收藏  举报