How to Check Database Size in MySQL
Method 1 of 2:
Using MySQL Workbench
- Open MySQL Workbench. It has a blue icon that with an image that resembles a dolphin. Click the icon to launch MySQL Workbench.
- 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]
- If SQL server is not listed on this screen, click New Connection and enter the server information, including hostname, port, username, and password.
- 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.
- Click the information icon. It's the icon that resembles an "i" next to the database name in the schema pane.
- 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
- 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.
- 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.
- Type SUM(data length + table length) 'Size in bytes', as the second line. This command will display the size of each table in bytes.
- 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.
- To display a rounded number in kilobytes, type ROUND(SUM(data_length + index_length) / 1024, 2) 'Size in KiB' instead.[3]
- Type FROM information_schema.tables as the last line. This command specifies which database tables to query.
- 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;
5 ★ | 1 Vote
You should read it
- Instructions on how to connect to MySQL Database in Eclipse
- Backup and restore MySQL with mysql-zrm on Debian Sarge
- A serious vulnerability on phpMyAdmin allows an attacker to destroy the database
- How to Connect to MySQL Using PHP
- Save your database with Recovery Toolbox for MySQL
- How to install MySQL on Ubuntu 20.04
- How to install and configure MySQL server on Pi
- How to Create a Secure Session Management System in PHP and MySQL
May be interested
- How to Learn PHP and MySQLphp is one of the most widely-used programming languages on the internet, and it allows you to do much more than simple html. mysql allows you to easily create and modify databases on your server. used together, these tools can create...
- How to install MySQL Workbench Community Edition on Windows 10detailed instructions on how to install mysql workbench community edition on windows 10 to manage operations with mysql database management system more easily ..
- Oracle improves MySQL on Windowsoracle has updated the commercial version of mysql database for windows, added a graphical installer and the ability to perform failover clustering, ...
- Guide to creating Virtual Hosting with PureFTPd and MySQLin the following article, tipsmake.com will show you how to install the pureftpd server using virtual user accounts from mysql's database, all inside the real system.
- MySQL vulnerabilities allow malicious servers to steal data from customerssomeone can take advantage of this problem to steal sensitive data from an improperly configured web server, allowing connection to untrusted servers or from database management applications. .
- How to Create a Table in MySQLtables make up the structure of your mysql databases. tables contain the information that is entered into the database, and can be created to suit basically any data storage need. creating a table only takes a few minutes, especially if...
- Compare the performance of MongoDB and SQL Server 2008in the following article, we will point out the difference in performance of the relatively new database management system, which is mongodb and one of the popular systems like sql server (mysql or oracle). most of the data is given here in the form of charts, so we can easily imagine the advantages and disadvantages of mongodb as well as other database management systems.
- Steps to Import data from different tables in MySQL Workbenchinstructions on how to export and import data from different tables in a mysql database through the mysql workbench tool
- How to Send Sql Queries to Mysql from the Command Linea simple text-based program called mysql should have been part of your mysql installation. it lets you send sql queries directly to the mysql server and output the results in text format. it is a quick and easy way to test your mysql...
- How to Install the MySQL Database Server on Your Windows PCthis wikihow teaches you how to install the mysql server program on a windows 10 computer. in order to install mysql on a windows computer, you must first have python 2.7 (not python 3+) installed. open the python download page. go to...