Skip to content
Home ยป Get all databases size of an instance/server in MB or GB (Human readable format)

Get all databases size of an instance/server in MB or GB (Human readable format)

db size

To List all databases with its size in MB or GB, below command can be used to get the information.

Below is the command to list all databases with its size in MB.
SELECT table_schema AS “Database name”, SUM(data_length + index_length) / 1024 / 1024 AS “Size (MB)” FROM information_schema.TABLES GROUP BY table_schema;

Screen Shot 2015-11-04 at 2.22.07 pm

 

Below is the command to list all database with its size in GB.
SELECT table_schema “database”, sum(data_length + index_length)/1024/1024/1024 “size in GB” FROM information_schema.TABLES GROUP BY table_schema;

Screen Shot 2015-11-04 at 2.23.54 pm

Leave a Reply

Your email address will not be published.

0 Shares
Tweet
Pin
Share
Share
Share
%d bloggers like this: