Explore Courses Blog Tutorials Interview Questions
0 votes
in SQL by (6.1k points)
How can I get the size of a MySQL database?

Assume the target database is called "B3".

1 Answer

0 votes
by (12.7k points)
edited by

Execute the following query and you will apparently get what you're expecting for:

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; 

Looking for a SQL Tutorial? Join the SQL Course to gain more knowledge on SQL.

If you want to learn MySQL then do check out the below MySQL tutorial video for better understanding:

Related questions

0 votes
1 answer
0 votes
1 answer
asked Dec 18, 2020 in SQL by Appu (6.1k points)
0 votes
1 answer

Browse Categories