mysql -u root -p -e "SELECT table_schema, ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS size_mb FROM information_schema.tables GROUP BY table_schema;"
mysql -u root -p -e "SELECT table_schema, ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS size_mb FROM information_schema.tables GROUP BY table_schema;"
Show the size of every database
Sums data_length plus index_length from information_schema.tables per schema and formats the total in megabytes. Values are approximate until flushed, but ideal for capacity reviews. Filter with WHERE table_schema NOT IN ('mysql', ...) to hide system schemas.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.