Command to show all MySQL databases and their sizes

I found this MySQL query to list all DBs and their sizes here. I wanted to blog it, so it is easier for me to find.

mysql -e 'SELECT table_schema AS "Database name", SUM(data_length + index_length) / 1024 / 1024 AS "Size (MB)" FROM information_schema.TABLES GROUP BY table_schema;'

Comments are closed.

Powered by WordPress. Designed by WooThemes