- Login to SSH via root.
- Now you have to enter below command:
Code:
mysql -u username –p
- You will see password prompt you have to enter password of your database.
- You have to enter below command to display all the databases and also you can see its size in MB.
Code:
Select table_schema `Database`, Round(Sum(data_length + index_length) / 1024 / 1024, 1)`Size in MB` FROM information_schema.TABLES WHERE table_schema =‘Databasename’;
You can use below command to check database size along with table size.
Code:
SELECT table_name AS "Table", ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)" FROM information_schema.TABLES WHERE table_schema = "database_name" ORDER BY (data_length + index_length) DESC;