> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Determining the size of MySQL databases and tables

> This article demonstrates how to check the size of MySQL databases and tables by using the phpMyAdmin web interface or the command-line "mysql" program.

This article demonstrates how to check the size of MySQL databases and tables. You can do this by using the phpMyAdmin web interface or by using the command-line *mysql* program.

<Note>
  To watch a video that demonstrates the following procedures, please click below:
</Note>

## Using phpMyAdmin

You can use the phpMyAdmin web interface to check the sizes of MySQL databases and tables. To do this, follow these steps:

1. Log in to cPanel.
   > 📘 Note
   >
   > If you do not know how to log in to your cPanel account, please see [this article](/docs/accessing-cpanel).

2. In the **DATABASES** section of the cPanel home screen, click **phpMyAdmin**:\
   ![cPanel - Databases - phyMyAdmin icon](https://static.hosting.com/kb/kb-cpanel-78-databases-phpmyadmin-icon.png)

   The phpMyAdmin administration page appears in a new window.

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

4. In the right pane, locate the **Size** column. phpMyAdmin lists the size of each table in the database:\
   ![phpMyAdmin - table size](https://static.hosting.com/kb/kb-phpmyadmin-table-size.png)

5. To obtain the total size of the database, scroll down to the end of the **Size** column:\
   ![phpMyAdmin - database size](https://static.hosting.com/kb/kb-phpmyadmin-database-size.png)

   > 📘 Note
   >
   > If the database contains a large number of tables, you may need to click the **>** icon to advance to the next page of tables. To obtain the total database size, add together the size totals from each page.

## Using the mysql command-line program

You can use the *mysql* command-line program to check the sizes of MySQL databases and tables. To do this, follow these steps:

1. Log in to your account [using SSH](/docs/using-ssh-secure-shell).

2. At the command line, type the following command, replacing *username* with your hosting.com account username:

   ```bash theme={null}
   mysql -u username -p
   ```

3. At the **Enter Password** prompt, type your password. When you type the correct password, the **mysql>** prompt appears.

4. To check the sizes of all of your databases, at the **mysql>** prompt type the following command:

   ```bash theme={null}
   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
   >
   > 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 lists of all of your databases and their corresponding size (in megabytes).

5. To check the sizes of all of the tables in a specific database, at the **mysql>** prompt, type the following command. Replace *database\_name* with the name of the database that you want to check:

   ```bash theme={null}
   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;
   ```

   > 📘 Note
   >
   > After the command finishes, it lists all of the tables and their corresponding size (in megabytes), with the largest table at the top and the smallest table at the bottom.

## More information

* For more information about phpMyAdmin, please visit [https://www.phpmyadmin.net](https://www.phpmyadmin.net).

* For more information about the mysql command-line program, please visit [https://mariadb.com/kb/en/mysql-command-line-client](https://mariadb.com/kb/en/mysql-command-line-client).

## Related articles

* [Accessing phpMyAdmin and phpPgAdmin](/docs/phpmyadmin-and-phppgadmin)

* [Connecting to MySQL from the command line](/docs/connect-to-mysql-from-the-command-line)

* [The information\_schema database](/docs/the-information-schema-database)

* [Managing MySQL databases, users, and tables from the command line](/docs/managing-mysql-databases-and-users-from-the-command-line)
