Check MySQL database size


This is an example on how to check mysql database size of cacti database.

mysql> show databases;
+——————–+
| Database           |
+——————–+
| information_schema |
| cacti              |
| mysql              |
| test               |
+——————–+
6 rows in set (0.00 sec)

The the command below.

mysql> SELECT table_schema cacti, sum( data_length + index_length ) / 1024 / 1024 “Database Size in MB” FROM information_schema.TABLES GROUP BY table_schema;

Output.

+——————–+———————+
| cacti              | Database Size in MB |
+——————–+———————+
| cacti              |       1620.85510254 |
| information_schema |          0.00000000 |
| mysql              |          0.64040279 |
| test               |          0.00208855 |
+——————–+———————+
4 rows in set, 8 warnings (0.00 sec)

That’s all!

,