Check MySQL Database Size: Quick Guide

You can determine the size of a MySQL database by following these steps:

1. Log in to the MySQL database.

mysql -u username -p

Choose the database you want to query.

use database_name;

Run the following query:

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

This query will return the size of all databases in megabytes, including both the data and index sizes.

bannerAds