查询mysql数据量,表数量脚本

#  查询数据库中每个库的数据量
SELECT table_schema AS "Database", SUM(data_length + index_length) / 1024 / 1024 AS "Size (MB)" FROM information_schema.TABLES GROUP BY table_schema;
#  查询数据库中每个库的表数据量
SELECT TABLE_SCHEMA, COUNT(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;

  

posted @ 2023-11-14 11:25  东峰叵,com  阅读(7)  评论(0编辑  收藏  举报