====== Check the size of all MySQL databases ======
The script below will get the sizes of all databases for a MySQL server. Make sure you "use" a database before you run the script.
CREATE TABLE z_db_size
SELECT TABLE_SCHEMA AS 'database_name', TABLE_NAME AS 'table_name',
((DATA_LENGTH + INDEX_LENGTH - DATA_FREE) / 1024 / 1024) AS size_in_mb
FROM INFORMATION_SCHEMA.TABLES;
Will create temporary table z_db_size
select database_name, sum(size_in_mb)
from z_db_size
group by database_name
order by sum(size_in_mb);
Once report is captured, drop temporary table
drop table z_db_size;