How to obtain the database size of a MySQL Server instance?
Database query
With this query you can obtain the size of the data, indexes and total for each database.
1 2 3 4 5 6 7 8 | select table_schema DBNAME, sum (data_length)/1024/1024 TABLESMB, sum (index_length)/1024/1024 INDEXESMB, sum ( data_length + index_length )/1024/1024 TOTALMB FROM information_schema.TABLES group by table_schema order by TOTALMB DESC ; |
The results are expressed in Megabytes (MB).