In this article, we’ll go through how check the Size of MySQL Database using SSH Command Line.
Follow the steps to check the MySQL database using of SSH:
- Log into SSH using “root”.
- Enter the following command:
mysql -u username -p - When the password prompt appears, enter the “password”.
- Copy the follow command, to display all the databases and their sizes in MB.#SELECT table_schema AS “Database”,ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS “Size (MB)” FROM information_schema.TABLES GROUP BY table_schema;
Note: If you are searching to display the size of a “single Database”, then you need to change the Databasename to your database.select table_schema `Database`, Round(Sum(data_length + index_length) / 1024 / 1024, 1)
`Size in MB` FROM information_schema.TABLES WHERE table_schema =
‘Databasename’;
Note: If you are looking to display the size of a “single Database with it’s tables”, then changed the Databasename to your database.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;
In this way, you can view the size of a MySQL database with the help of command line. For more information on MySQL database, visit to our knowledge base section.
If you want to use phpMyAdmin to determine the size of the MySQL database then Read this How to check the size of MySQL database using phpMyAdmin