Check Database size in MySQL

Login to mysql with your usernamse and password.
eg: mysql u root -proot

Then execute the following command:

SELECT table_schema "DB Name", ROUND(SUM(data_length + index_length)/1024/1024, 2) "Size in MBs"
FROM information_schema.tables
GROUP BY table_schema;

Here SUM(data_length + index_length) is in bytes. Hence we have divided it twice by 1024 to convert to Megabytes.

Tags:

Share:

7 comments