1. Home
  2. Hosting Management
  3. Troubleshooting
  4. How to determine the size of MySQL databases and tables in phpMyAdmin

How to determine the size of MySQL databases and tables in phpMyAdmin

In this guide, we will show you how to find the size of MySQL databases and tables. You can use the phpMyAdmin web interface to determine the sizes of MySQL databases and tables.

How to determine the size of MySQL databases and tables in phpMyadmin

To do this, follow these steps:

This tutorial assumes that you’re already logged into cPanel.

In the Databases section of the cPanel home screen, click phpMyAdmin. The phpMyAdmin administration page appears in a new window.

In the left pane, click the name of the database that you want to view.

In the right pane, locate the Size column. phpMyAdmin displays the size of each table in the database:

Database Size

To obtain the total size of the database, scroll down to the end of the Size column.

If the database contains a large number of tables, you may need to click the > icon to advance to the next page of tables.

Add together the size totals on each page to obtain the total database size.

How to list all table sizes from all databases

If you’re running into an issue where your database size is growing, but you don’t know which table is the culprit, it may be useful to query for the size of all tables within all existing databases.

In phpMydmin, locate the ‘SQL‘ tab, then execute the following query:

 SELECT
TABLE_SCHEMA AS `Database`,
TABLE_NAME AS `Table`,
ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`
FROM
information_schema.TABLES
ORDER BY
(DATA_LENGTH + INDEX_LENGTH)
DESC;

Click on Go button.

Depending on how many databases you have and how large they are, this command may take a minute or two to complete.

After the command finishes, it will return not only the size of the tables but also the table name and parent database it is associated.

Updated on July 6, 2019

Was this article helpful?

Related Articles

Need help?
We're always here for you. Submit a ticket or Chat with a live person.
Submit Ticket