Get the size of all MySQL databases

This is how you can get the size of all your MySQL databases with only one select call. I will result in a list of the name of each database, except the "information_schema" and the size of each database in MB.

 

SELECT table_schema 'db_name', SUM( data_length + index_length) / 1024 / 1024 'db_size_in_mb' FROM information_schema.TABLES WHERE table_schema != "information_schema" GROUP BY table_schema
Knowledge keywords: