Getting the total size taken by a MySQL database
Last updated:Just run this query:
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 ;
and you'll get a result like this:
+--------------------+----------------------+------------------+
| Data Base Name | Data Base Size in MB | Free Space in MB |
+--------------------+----------------------+------------------+
| my_database | 1485.25000000 | 75858.00000000 |
| information_schema | 0.00878906 | 0.00000000 |
| mysql | 0.85281849 | 0.09124756 |
| performance_schema | 0.00000000 | 0.00000000 |
+--------------------+----------------------+------------------+
References: