gzoaeq
Last Updated: February 21, 2018
·
17
· reekenx
My photo normal

Mysql Database size in GB

Useful before doing database dump to learn how big database is. To get database size information in GB run SQL query:

SELECT table_schema AS "Database", 
       Round(Sum(data_length + index_length) / 1024 / 1024 / 1024, 1) AS "Size in GB" 
FROM information_schema.tables 
GROUP BY table_schema

This will dump something like:

+--------------------+------------+
| Database           | Size in GB |
+--------------------+------------+
| project1           |       29.1 |
| project2           |        2.8 |
| project3           |        5.6 |
| mysql              |        0.0 |
+--------------------+------------+
4 rows in set, 0 warning (0.45 sec)

More tips in my native Lithuanian language can be found on my blog at https://www.jarmalavicius.lt/

Say Thanks
Respond