How to get the size of database ?

I want to know the size of database using mysql query.

rahulk's picture

To check the size of Database..

Query will be like this.

mysql> 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; 

And the result will be like...

+--------------------+---------------+
| DB_Name            | DB Size in MB |
+--------------------+---------------+
| cakephp            |           0.0 |
| drupal7            |           6.4 |
| drupal8            |          10.6 |