Mysql – get size of all databases

Mysql contains size of all tables in information_schema.TABLES table. The following query can be used to get size of all databases on a mysql server:

SELECT table_schema "DBName",
  sum( data_length + index_length ) / 1024 / 1024 "DBSize-MB"
FROM information_schema.TABLES
GROUP BY table_schema

Here is the sample outcome
mysql-query-get-db-size

Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit

Comments

Click here to write/view comments