본문으로 바로가기

mysql DB 용량 조회

category [ 서버 & DB 관련 ]/MySQL 2021. 11. 22. 23:14
SELECT table_schema "Database", ROUND(SUM(data_length+index_length)/1024/1024,1) "MB" FROM information_schema.TABLES GROUP BY 1;


+--------------------+--------+
| Database           | MB     |
+--------------------+--------+
| hello              | 1086.7 | 
| information_schema |    0.0 |
| jmnote             |  217.3 |
| mysql              |    0.5 |
+--------------------+--------+

 

SELECT SUM(data_length+index_length)/1024/1024 used_MB, SUM(data_free)/1024/1024 free_MB FROM information_schema.tables;

+---------------+---------------+
| used_MB       | free_MB       |
+---------------+---------------+
| 2775.87963295 | 5230.69857121 | 
+---------------+---------------+