How to Check Database Size in MySQL

This wikiHow teaches you how to check the size of a MySQL database. You can check the size of a database using MySQL Workbench, or by running a query in MySQL. Open MySQL Workbench. It has a blue icon that with an image that resembles a...

Method 1 of 2:

Using MySQL Workbench

  1. Picture 1 of How to Check Database Size in MySQL
    Open MySQL Workbench. It has a blue icon that with an image that resembles a dolphin. Click the icon to launch MySQL Workbench.
  2. Picture 2 of How to Check Database Size in MySQL
    Connect to the MySQL server. Double-click the MySQL server on under the SQL Development module in the start-up screen. Then enter the database password to connect. [1]
    1. If SQL server is not listed on this screen, click New Connection and enter the server information, including hostname, port, username, and password.
  3. Picture 3 of How to Check Database Size in MySQL
    Hover over the database in the schema pane. It's in the sidebar to the left. This displays a couple of icons to the right of the database name.
  4. Picture 4 of How to Check Database Size in MySQL
    Click the information icon. It's the icon that resembles an "i" next to the database name in the schema pane.
  5. Picture 5 of How to Check Database Size in MySQL
    Click the Info tab. It's the first tab in the main pane in the center. This displays information about the database. The database size is listed next to "Database size (rough estimate). this displays a rough estimate of the size of the database. [2]
Method 2 of 2:

Running a Query

  1. Picture 6 of How to Check Database Size in MySQL
    Connect to a MySQL server. There are a number of apps you can use to connect to a MySQL database, including MySQL Workbench. You can also query a MySQL database in the command line in Windows, or terminal on Mac. Once MySQL is installed on your computer you'll need to navigate to the MySQL directory in the Windows command line and type mysql -u root -p. Then enter the password for your database.
  2. Picture 7 of How to Check Database Size in MySQL
    Type SELECT table_schema "DB Name", as the first line of your query. This is the select command to query run a query on the database.
  3. Picture 8 of How to Check Database Size in MySQL
    Type SUM(data length + table length) 'Size in bytes', as the second line. This command will display the size of each table in bytes.
  4. Picture 9 of How to Check Database Size in MySQL
    Type ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) 'Size in MiB' as the next line. This displays a rounded number of the size in megabytes.
    1. To display a rounded number in kilobytes, type ROUND(SUM(data_length + index_length) / 1024, 2) 'Size in KiB' instead.[3]
  5. Picture 10 of How to Check Database Size in MySQL
    Type FROM information_schema.tables as the last line. This command specifies which database tables to query.
  6. Picture 11 of How to Check Database Size in MySQL
    Type GROUP BY table_schema; and execute the query. This will display the size of your databases. You can also type {[kbd|WHERE table_schema = 'database name';}} to check the size of a specific database. Type the actual name of the database in place of "database name". Your query should look something like this:
     SELECT table_schema "DB Name" SUM(data length + table length) 'Size in bytes', ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) 'Size in MiB' FROM information_schema.tables GROUP BY table_schema; 
Update 05 March 2020
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile