Thursday, August 20, 2015

MySQL - Check all database size and free size in MB

SQL command :
SELECT table_schema "Data Base Name", 
sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB", 
sum( data_free )/ 1024 / 1024 "Free Space in MB" 
FROM information_schema.TABLES 
GROUP BY table_schema ;

Example result:
+--------------------+----------------------+------------------+
| Data Base Name     | Data Base Size in MB | Free Space in MB |
+--------------------+----------------------+------------------+
| e-virtue           |           0.06250000 |       0.00000000 |
| ict_iptho          |           0.07812500 |       0.00000000 |
| information_schema |           0.00976563 |       0.00000000 |
| mysql              |           0.78106689 |       0.00000000 |
| performance_schema |           0.00000000 |       0.00000000 |
| spppm              |           0.02952194 |       0.00000000 |
| sptrba_db          |           0.14062500 |       0.00000000 |
+--------------------+----------------------+------------------+
8 rows in set (0.02 sec)

No comments:

Post a Comment