Find all MySQL databases sizes

Okay, i just came onto this today, and i find it highly useful to get an sql database usage at a glance:

SELECT table_schema “Data Base Name”, SUM( data_length + index_length) / 1024 / 1024
“Data Base Size in MB” FROM information_schema.TABLES GROUP BY table_schema ;

LE: If you want to see the size of the tables in a certain db:

SELECT table_name AS “Tables”,  round(((data_length + index_length) / 1024 / 1024), 2) “Size in MB”  FROM information_schema.TABLES  WHERE table_schema = “your_database_name”;

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge