MySQL management tools MySQL Utilities query the size of the space used by MySQL

Source: Internet
Author: User

When we are ready to back up or maintain data, we often consider the size of disk space, and usually need to know how large our data and logs are. Data is vital and the data is the lifeline.

Use the Mysqldiskusage tool to view the space used by the database instance, including the database and various log sizes.

Instance

shell> sudo env pythonpath= $PYTHONPATH mysqldiskusage \
--server=root:root@localhost--all
# Source on localhost: connected.
# Database Totals:
+-----------------+--------------+
|       db_name | Total |
+-----------------+--------------+
| OLTP2 | 829,669 |
| BVM | 15,129 |
| DB1 | 9,895 |
| DB2 | 11,035 |
| Employees | 206,117,692 |
| Griots | 14,415 |
| MySQL | 995,722 |
| OLTP1 | 177,393 |
| Room_temp | 9,847 |
| Sakila | 791,727 |
| Test | 647,911 |
| Test_arduino | 9,999 |
| Welford_kindle | 72,032 |
| World | 472,785 |
| World_innodb | 829,669 |
+-----------------+--------------+

Total database disk usage = 210,175,251 bytes or 200.44 MB

# Log information.
+--------------------+--------------+
|        Log_name | Size |
+--------------------+--------------+
| Host123.log | 957,282,265 |
|     Host123-slow.log | 123,647 |
| Host123.local.err | 321,772,803 |
+--------------------+--------------+

Total size of logs = 1,279,178,715 bytes or 1.19 GB

# Binary Log information:
Current binary log file = my_log.000287
+----------------+---------+
| Log_file | Size |
+----------------+---------+
| my_log.000285 | 252208 |
| my_log.000286 | 256 |
| my_log.000287 | 3063 |
| My_log.index | 48 |
+----------------+---------+

Total size of binary logs = 255,575 bytes or 249.58 KB

# Server is not ' an active slave-no relay log information.
# InnoDB Tablespace Information:
+--------------+--------------+
|        Innodb_file | Size |
+--------------+--------------+
|   Ib_logfile0 | 5,242,880 |
|   Ib_logfile1 | 5,242,880 |
| Ibdata1 | 815,792,128 |
|  Ibdata2 | 52,428,800 |
+--------------+--------------+

Total size of InnoDB files = 889,192,448 bytes or 848.00 MB

InnoDB freespace = 635,437,056 bytes or 606.00 MB
Using the –all option, all logs and InnoDB disk usage are displayed. All databases are also listed, even if they do not contain any data.

Permissions

The user must have permission to read the data directory.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.