How to check MYSQL Database size in phpMyAdmin and via command?

Sometimes it is required to check the MySQL Database size. You can check it from the phpMyAdmin as well as using ssh.

From phpMyAdmin 

 

  1. Login to cPanel. Skip this step if you have installed MySQL Database in Windows. You can directly open phpMyAdmin using server ipaddress:8080

  2. Click on phpMyAdmin.



  3. Select the Database which size you want to check.



  4. Go to the size column. At the end of the column, you can view the size of that Database as per below image.



From SSH Command

 

  1. Login to SSH using root.

  2. Enter in MySQL using the following command.
mysql -u username -p

MySQL username will be root

  1. Enter the Password once Password prompt appears.

  2. Copy/Paste the below command to display all the Databases with its size 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;

If you are looking to display the size of a single Database. 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’;

If you are looking to display the size of a single Database along with its tables. Change 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;
  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

How to rename MySQL Database table from phpMyAdmin?

It’s very easy to rename a table in phpMyAdmin. To do so, simply follow these steps: MySQL...

How to Fix MySQL Error "The server quit without updating PID file"?

MySQL server plays a vital role for your Linux Server. It runs all of your website's databases,...

How to connect MySQL using node js?

This article will show you how to connect to a MySQL database using the Node.js. Note: Node.js...

Fix :: Unable to login in phpMyadmin after revoking MySQL root user

Problem Statement I am not able to login into phpMyadmin after revoking root user. Solution...

How to change MySQL root password from WHM?

In this article, we will describe steps to change the root password of MySQL server from WHM....