Here is the SQL command you should use when you need to calculate the size of databases on your MySQL server directly from the MySQL console:
SELECT table_schema AS "DB Name",
SUM(data_length + index_length) / 1024 / 1024 AS "DB Size in MB",
SUM(data_free)/ 1024 / 1024 AS "Free Space in MB"
FROM information_schema.TABLES
GROUP BY table_schema;
You can run this SQL command after logging into your MySQL console. It will provide a summary showing each database name, its total size in megabytes, and the free space available.
Enjoy!