All HowTo's MySQL & MariaDB

Get MySQL Database Sizes

Log into MySQL and issue the following command as it is:

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

And you’ll get something like the following:

+--------------------+--------------+
| Database name      | Size (MB)    |
+--------------------+--------------+
| my_db1             | 957.12350256 |
| my_db2             | 957.12350256 |
| my_db3             | 957.12350256 |
+--------------------+--------------+

I’ve removed a few databases from the above to simplify things.