Last Updated: February 25, 2016
·
369
· ninjascribble

Get the real size of your MySQL database

mysql> 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;
+--------------------+----------------------+------------------+
| Data Base Name     | Data Base Size in MB | Free Space in MB |
+--------------------+----------------------+------------------+
| information_schema |           0.00878906 |       0.00000000 |
| mysql              |           6.43213463 |     355.00080490 |
| performance_schema |           0.00000000 |       0.00000000 |
+--------------------+----------------------+------------------+