Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I know the database size of specific database in MYSQL?

I have a database named 'phonebook'. It contains 10+ tables with a moderate amount of data.
Now I want to know the database size of this 'phonebook' database using MySQL query.
How can I do that?

like image 665
Prodip Kirtania Avatar asked Sep 19 '25 07:09

Prodip Kirtania


1 Answers

Try this, it provides the size of a specified database in MBs.

Make sure you specify DB_NAME

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

Hope this will help you ! .

like image 165
Taha Avatar answered Sep 21 '25 00:09

Taha