Nuestra base de conocimientos sólo está disponible actualmente en inglés. Estamos en el proceso de traducir estas páginas y las publicaremos cuando estén disponibles.
MySQL Database Size | How To List MySQL Table Size?
This article demonstrates how to determine MySQL database size and MySQL table size. You can do this by using the phpMyAdmin web interface or by using the command line.
To watch a video that demonstrates the following procedures, please click below:
Using phpMyAdmin to determine MySQL database size
You can use the phpMyAdmin web interface to determine the sizes of MySQL databases and tables. To do this, follow these steps:
- Log in to cPanel.
If you do not know how to log in to your cPanel account, please see this article
- 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:
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.
Using the command line
You can use the mysql command-line program to determine the sizes of MySQL databases and tables. To do this, follow these steps:
- Log in to your account using SSH.
- At the command line, type the following command, replacing username with your A2 Hosting account username:
mysql -u username -p
- At the Enter Password prompt, type your password. When you type the correct password, the mysql> prompt appears.
To determine the sizes of all of your databases, at the mysql> prompt type the following command:
SELECT table_schema AS "Database",
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)"
GROUP BY table_schema;
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 displays a list of all of your databases and their corresponding size (in megabytes).
To determine 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:
SELECT table_name AS "Table",
ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)"
WHERE table_schema = "database_name"
ORDER BY (data_length + index_length) DESC;
After the command finishes, it displays a list of all of the tables and their corresponding size (in megabytes), with the largest table at the top and smallest table at the bottom.
- Accessing phpMyAdmin and phpPgAdmin
You can use phpMyAdmin and phpPgAdmin to manage all aspects of your databases. You can create and browse tables, import data, and much more.
- Connecting to MySQL from the command line
Learn how to connect to MySQL from the command line using the mysql program with this guide including detailed instructions, code snippets and links to related articles.
- The information_schema database
When you view MySQL databases in phpMyAdmin or by using the mysql command-line program, you may also notice an information_schema database. Learn about this database and its purpose here.