MySQL Query to calculate DB and Table sizes


Calculate sizes of all your databases in MB:

SELECT table_schema "DB Name", SUM( data_length + index_length) / 1024 / 1024  "DB Size" FROM information_schema.TABLES GROUP BY table_schema;

Calculate table sizes for a specific database:

SELECT TABLE_NAME, table_rows, data_length, index_length,  round(((data_length + index_length) / 1024 / 1024),2) "Size in MB" FROM information_schema.TABLES WHERE table_schema = "PUT_YOUR_DATABASE_NAME_HERE";