Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to see the size of all your MySQL databases

This guide shows you how to find out how much space each database uses.

Databases2 min read11 steps

Why check sizes?

A database is where your site stores its data. Over time it grows. Big databases can slow a site and use up your disk space. Knowing the size helps you decide what to clean up. Sizes are shown in MB, short for megabytes. A megabyte is a small unit of storage.

Way 1: cPanel

  1. Log in to your client area. Open your hosting service and log in to cPanel.
  2. Under Databases, click MySQL Databases.
  3. Look at Current Databases.
  4. The Size column shows how big each one is.

Way 2: phpMyAdmin

  1. In cPanel, click phpMyAdmin.
  2. Click Databases at the top.
  3. Click Enable statistics if shown.
  4. Read the total size at the end of each row.

To see the size of one table, click the database and look at the Size column of the table list.

Way 3: an SQL query

This works in phpMyAdmin (SQL tab), MySQL Workbench or the command line.

  1. Open a place where you can run SQL. In phpMyAdmin, click the SQL tab.
  2. Paste this query:
    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
    ORDER BY 2 DESC;
    This lists each database and its size in MB, from biggest to smallest. It adds up the data and index sizes. An index is a helper that makes searches faster.
  3. Click Go.

On shared hosting, you only see your own databases.

Way 4: command line

If you have SSH access, you can run the same query:

mysql -u username -p -e "SELECT table_schema, ROUND(SUM(data_length+index_length)/1024/1024,2) AS MB FROM information_schema.tables GROUP BY table_schema;"

This prints the list straight in your terminal.

Tip: The numbers are close estimates, not exact to the byte. A database that has had many deletions may show a bit more than it needs. Optimizing it can shrink it.

Questions about space limits? Open a support ticket.

Quick recap

  • cPanel MySQL Databases shows a size for each database.
  • phpMyAdmin and an SQL query show more detail.
  • Sizes are in megabytes.
  • Large databases may need cleaning or optimizing.