mysqldiskusage

mysqldiskusage可以查看binary log, slow query log, error log, general query log, relay log,InnoDB tablespaces,database的空间使用情况

eg1:查看luoxuan、xiyan库空间使用情况,如果xiyan库下面没有表的话,xiyan库是不去计算大小的

$ sudo ./mysqldiskusage --server=root@localhost:3306 luoxuan xiyan
# Source on localhost: ... connected.
# Database totals:
+----------+----------+
| db_name  |   total  |
+----------+----------+
| luoxuan  | 131,589  |
| xiyan    | 127,397  |
+----------+----------+
 
Total database disk usage = 258,986 bytes or 252.00 KB

eg2:查看所有信息

$  sudo ./mysqldiskusage --server=root@localhost:3306 -a -vv
# Source on localhost: ... connected.
# Database totals:
+---------------------+--------------+------------+-------------+----------+
| db_name             | db_dir_size  | data_size  | misc_files  |   total  |
+---------------------+--------------+------------+-------------+----------+
| luoxuan             | 115,205      | 16,384     | 115,205     | 131,589  |
| mysql               | 891,355      | 671,167    | 202,366     | 873,533  |
| performance_schema  | 154,041      | 0          | 154,041     | 154,041  |
| xiyan               | 111,013      | 16,384     | 111,013     | 127,397  |
+---------------------+--------------+------------+-------------+----------+
 
Total database disk usage = 1,286,560 bytes or 1.00 MB
 
# Log information.
+---------------+------------+
| log_name      |      size  |
+---------------+------------+
| db170075.log  | 5,258,516  |
| slow.log      |    18,756  |
| alert.log     |   168,451  |
+---------------+------------+
 
Total size of logs = 5,445,723 bytes or 5.00 MB
 
# binary log information:
Current binary log file = mysql-bin.002588
ERROR: The binary log are missing.

最后这个错误应该是mysql的bug引起的,根据log_bin去找文件,找不到文件,报错

root@(none) 07:07:53>show variables like 'log_bin'; 
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_bin       | ON    |
+---------------+-------+

Setting this option causes the log_bin system variable to be set to ON (or 1), and not to the basename. This is a known issue; see Bug #19614 for more information.


Post a Comment