LLI Wiki — My Digital Knowledge Base

MySQL: size of each database

List the size of each MySQL database in MB, from information_schema.

The following query lists the size of each database on a MySQL or MariaDB server. The size is the sum of the data and index lengths of the tables stored in information_schema, in MB rounded to one decimal.

SELECT table_schema "DB Name",
        ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
FROM information_schema.tables
GROUP BY table_schema;

Notes

Mastodon LLIMastodon SocialFosstodon