This post describes get information of database space in MySQL. By default can easily view on end of the row on PHPMyAdmin panel, do you want to know in command line, Login into server execute the query.
Database Size in MB :
The below query shows output all database size in MB.
SELECT table_schema AS "DATABASE NAME", SUM(data_length + index_length) / 1024 / 1024 AS "Size IN (MB)" FROM information_schema.TABLES GROUP BY table_schema;
+-----------------------+--------------+
| DATABASE NAMES | Size IN (MB) |
+-----------------------+--------------+
| linux_database | 112.75957447 |
| linux_datakey | 21.06849629 |
| network_datab | 12.32820820 |
| netip_address | 493.34534535 |
+-----------------------+--------------+
Database Size in GB :
SELECT table_schema "DATABASE NAME", sum(data_length + index_length)/1024/1024/1024 "SIZW IN GB" FROM information_schema.TABLES GROUP BY table_schema;
+-----------------------+----------------+
| DATABASE NAME | Size IN GB |
+-----------------------+----------------+
| data_a | 0.000020881183 |
| data_stats | 0.000009536743 |
| test_datam | 0.005599975586 |
+-----------------------+----------------+
Specific Database Size in MB :
SELECT table_schema "database", sum(data_length + index_length)/1024/1024 "size in GB" FROM information_schema.TABLES WHERE table_schema='linuxfaq_data' GROUP BY table_schema;
+----------------+--------------+
| database | size in MB |
+----------------+--------------+
| linuxfaq_data | 512.63432423 |
+----------------+--------------+
1 row in set (0.00 sec)
Specific Database Size in GB :
SELECT table_schema "database", sum(data_length + index_length)/1024/1024/1024 "size in GB" FROM information_schema.TABLES WHERE table_schema='linuxfaq_data' GROUP BY table_schema;
+----------------+----------------+
| database | size in GB |
+----------------+----------------+
| linuxfaq_data | 0.482106339186 |
+----------------+----------------+
1 row in set (0.00 sec)
Comments (0)