How to list MySQL databases with their respective size

I have one server with a lot of MySQL databases, and I wanted to know witch ones are taking up most of the disk space.

Execute this query as MySQL root user:

SELECT `table_schema` AS `Database`, SUM(`data_length` + `index_length`) / 1024 / 1024 AS `size` FROM `information_schema`.`TABLES` GROUP BY `table_schema` ORDER BY `size` DESC;

Te output will display all the MySQL databases and the size of them (in megabytes).

MySQL tables with size in MB
A list of MySQL databases with size in MB

Leave a Reply

Your email address will not be published. Required fields are marked *