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.

In GB

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

IN MB

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.

 

SELECT 
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.

#1
#2
#3
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!!

0 Comments

Leave a Reply

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.