統計mysql數據庫每個庫的大小,表總數等 作用:統計每個庫的真實數據與索引數據的總和的大小單位為MB,真實數據的大小單位MB,索引數據的大小MB,含有表的總數,當前日期。並且以每個庫的大小倒序排序。 Sql代碼 SELECT table_schema,\ SUM(data_length+index_length)/1024/1024 AS total_mb,\ SUM(data_length)/1024/1024 AS data_mb,\ SUM(index_length)/1024/1024 AS index_mb,\ COUNT(*) AS tables,\ CURDATE() AS today \ FROM information_schema.tables \ GROUP BY table_schema \ ORDER BY 2 DESC;