Reading Time: < 1 minute

Hi all, this document deals with how to check the size of the individual database in MySQL or MariaDB.
Sometimes as a database administrator it’s required to check the size of the individual databases in database servers. So here is the command to check the sizes.

Step 1: log in to Database server ( Mysql/MariaDB)

mysql -u root -p

Step 2: Execute the following command to get the individual size of all the schemas.


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


SELECT table_schema "DB Name",
ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" 
FROM information_schema.tables 
GROUP BY table_schema;

Here is the command to see the Size of the table.


table_name AS `Table`, 
ROUND(((data_length + index_length) / 1024 / 1024/1024), 2) `Size in GB` 
FROM information_schema.TABLES 
WHERE table_schema = "<SCHEMA_NAME>";

© 2019, Techrunnr. All rights reserved.

Questions Answered
Articles Written
Overall Points

Prabhin Prabharkaran

He is Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!!


Leave a Reply