重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

处理删除二进制日志后,showbinarylogs显示File_size为0的情况

服务器硬盘空间占用过大,发现二进制日志文件过多,于是删除MySQL的二进制日志文件:

成都创新互联专注于大悟企业网站建设,响应式网站建设,商城网站建设。大悟网站建设公司,为大悟等地区提供建站服务。全流程按需策划,专业设计,全程项目跟踪,成都创新互联专业和态度为您提供的服务

[root@iZbp1b36sef813d0zilqd6Z mysql] # rm -rf dbbin.00010*
[root@iZbp1b36sef813d0zilqd6Z mysql] #  rm  -rf  dbbin.00010*
[root@iZbp1b36sef813d0zilqd6Z mysql] #  rm  -rf  dbbin.00011*
[root@iZbp1b36sef813d0zilqd6Z mysql] #  rm  -rf  dbbin.00012*

然后通过mysql命令行查看:

mysql> show binary logs;
+--------------+------------+
| Log_name     | File_size  |
+--------------+------------+
| dbbin.000001 |          0 |
| dbbin.000002 |          0 |
| dbbin.000003 |          0 |
| dbbin.000004 |          0 |
| dbbin.000005 |          0 |
| dbbin.000006 |          0 |
| dbbin.000007 |          0 |
| dbbin.000008 |          0 |
| dbbin.000009 |          0 |
| dbbin.000010 |          0 |
| dbbin.000011 |          0 |
| dbbin.000012 |          0 |
| dbbin.000013 |          0 |
| dbbin.000014 |          0 |
| dbbin.000015 |          0 |
| dbbin.000016 |          0 |
| dbbin.000017 |          0 |
| dbbin.000018 |          0 |
| dbbin.000019 |          0 |
| dbbin.000020 |          0 |
| dbbin.000021 |          0 |
| dbbin.000022 |          0 |
| dbbin.000023 |          0 |
| dbbin.000024 |          0 |
| dbbin.000025 |          0 |
| dbbin.000026 |          0 |
| dbbin.000027 |          0 |
| dbbin.000028 |          0 |
| dbbin.000029 |          0 |
| dbbin.000030 |          0 |
| dbbin.000031 |          0 |
| dbbin.000032 |          0 |
| dbbin.000033 |          0 |
| dbbin.000034 |          0 |
| dbbin.000035 |          0 |
| dbbin.000036 |          0 |
| dbbin.000037 |          0 |
| dbbin.000038 |          0 |
| dbbin.000039 |          0 |
| dbbin.000040 |          0 |
| dbbin.000041 |          0 |
| dbbin.000042 |          0 |
| dbbin.000043 |          0 |
| dbbin.000044 |          0 |
| dbbin.000045 |          0 |
| dbbin.000046 |          0 |
| dbbin.000047 |          0 |
| dbbin.000048 |          0 |
| dbbin.000049 |          0 |
| dbbin.000050 |          0 |
| dbbin.000051 |          0 |
| dbbin.000052 |          0 |
| dbbin.000053 |          0 |
| dbbin.000054 |          0 |
| dbbin.000055 |          0 |
| dbbin.000056 |          0 |
| dbbin.000057 |          0 |
| dbbin.000058 |          0 |
| dbbin.000059 |          0 |
| dbbin.000060 |          0 |
| dbbin.000061 |          0 |
| dbbin.000062 |          0 |
| dbbin.000063 |          0 |
| dbbin.000064 |          0 |
| dbbin.000065 |          0 |
| dbbin.000066 |          0 |
| dbbin.000067 |          0 |
| dbbin.000068 |          0 |
| dbbin.000069 |          0 |
| dbbin.000070 |          0 |
| dbbin.000071 |          0 |
| dbbin.000072 |          0 |
| dbbin.000073 |          0 |
| dbbin.000074 |          0 |
| dbbin.000075 |          0 |
| dbbin.000076 |          0 |
| dbbin.000077 |          0 |
| dbbin.000078 |          0 |
| dbbin.000079 |          0 |
| dbbin.000080 |          0 |
| dbbin.000081 |          0 |
| dbbin.000082 |          0 |
| dbbin.000083 |          0 |
| dbbin.000084 |          0 |
| dbbin.000085 |          0 |
| dbbin.000086 |          0 |
| dbbin.000087 |          0 |
| dbbin.000088 |          0 |
| dbbin.000089 |          0 |
| dbbin.000090 |          0 |
| dbbin.000091 |          0 |
| dbbin.000092 |          0 |
| dbbin.000093 |          0 |
| dbbin.000094 |          0 |
| dbbin.000095 |          0 |
| dbbin.000096 |          0 |
| dbbin.000097 |          0 |
| dbbin.000098 |          0 |
| dbbin.000099 |          0 |
| dbbin.000100 |          0 |
| dbbin.000101 |          0 |
| dbbin.000102 |          0 |
| dbbin.000103 |          0 |
| dbbin.000104 |          0 |
| dbbin.000105 |          0 |
| dbbin.000106 |          0 |
| dbbin.000107 |          0 |
| dbbin.000108 |          0 |
| dbbin.000109 |          0 |
| dbbin.000110 |          0 |
| dbbin.000111 |          0 |
| dbbin.000112 |          0 |
| dbbin.000113 |          0 |
| dbbin.000114 |          0 |
| dbbin.000115 |          0 |
| dbbin.000116 |          0 |
| dbbin.000117 |          0 |
| dbbin.000118 |          0 |
| dbbin.000119 |          0 |
| dbbin.000120 |          0 |
| dbbin.000121 |          0 |
| dbbin.000122 |          0 |
| dbbin.000123 |          0 |
| dbbin.000124 |          0 |
| dbbin.000125 |          0 |
| dbbin.000126 |          0 |
| dbbin.000127 |          0 |
| dbbin.000128 |          0 |
| dbbin.000129 |          0 |
| dbbin.000130 |          0 |
| dbbin.000131 |          0 |
| dbbin.000001 |          0 |
| dbbin.000002 |          0 |
| dbbin.000003 |          0 |
| dbbin.000004 |          0 |
| dbbin.000005 |          0 |
| dbbin.000006 |          0 |
| dbbin.000007 |          0 |
| dbbin.000008 |          0 |
| dbbin.000009 |          0 |
| dbbin.000010 |          0 |
| dbbin.000011 |          0 |
| dbbin.000012 |          0 |
| dbbin.000013 |          0 |
| dbbin.000014 |          0 |
| dbbin.000015 |          0 |
| dbbin.000016 |          0 |
| dbbin.000017 |          0 |
| dbbin.000018 |          0 |
| dbbin.000019 |          0 |
| dbbin.000020 |          0 |
| dbbin.000021 |          0 |
| dbbin.000022 |          0 |
| dbbin.000023 |          0 |
| dbbin.000024 |          0 |
| dbbin.000025 |          0 |
| dbbin.000026 |          0 |
| dbbin.000027 |          0 |
| dbbin.000028 |          0 |
| dbbin.000029 |          0 |
| dbbin.000030 |          0 |
| dbbin.000031 |          0 |
| dbbin.000032 |          0 |
| dbbin.000033 |          0 |
| dbbin.000034 |          0 |
| dbbin.000035 |          0 |
| dbbin.000036 |          0 |
| dbbin.000037 |          0 |
| dbbin.000038 |          0 |
| dbbin.000039 |          0 |
| dbbin.000040 |          0 |
| dbbin.000041 |          0 |
| dbbin.000042 |          0 |
| dbbin.000043 |          0 |
| dbbin.000044 |          0 |
| dbbin.000045 |          0 |
| dbbin.000046 |          0 |
| dbbin.000047 |          0 |
| dbbin.000048 |          0 |
| dbbin.000049 |          0 |
| dbbin.000050 |          0 |
| dbbin.000051 |          0 |
| dbbin.000052 |          0 |
| dbbin.000053 |          0 |
| dbbin.000054 |          0 |
| dbbin.000055 |          0 |
| dbbin.000056 |          0 |
| dbbin.000057 |          0 |
| dbbin.000058 |          0 |
| dbbin.000059 |          0 |
| dbbin.000060 |          0 |
| dbbin.000061 |          0 |
| dbbin.000062 |          0 |
| dbbin.000063 |          0 |
| dbbin.000064 |          0 |
| dbbin.000065 |          0 |
| dbbin.000066 |          0 |
| dbbin.000067 |          0 |
| dbbin.000068 |          0 |
| dbbin.000069 |          0 |
| dbbin.000070 |          0 |
| dbbin.000071 |          0 |
| dbbin.000072 |          0 |
| dbbin.000073 |          0 |
| dbbin.000074 |          0 |
| dbbin.000075 |          0 |
| dbbin.000076 |          0 |
| dbbin.000077 |          0 |
| dbbin.000078 |          0 |
| dbbin.000079 |          0 |
| dbbin.000080 |          0 |
| dbbin.000081 |          0 |
| dbbin.000082 |          0 |
| dbbin.000083 |          0 |
| dbbin.000084 |          0 |
| dbbin.000085 |          0 |
| dbbin.000086 |          0 |
| dbbin.000087 |          0 |
| dbbin.000088 |          0 |
| dbbin.000089 |          0 |
| dbbin.000090 |          0 |
| dbbin.000091 |          0 |
| dbbin.000092 |          0 |
| dbbin.000093 |          0 |
| dbbin.000094 |          0 |
| dbbin.000095 |          0 |
| dbbin.000096 |          0 |
| dbbin.000097 |          0 |
| dbbin.000098 |          0 |
| dbbin.000099 |          0 |
| dbbin.000100 |          0 |
| dbbin.000101 |          0 |
| dbbin.000102 |          0 |
| dbbin.000103 |          0 |
| dbbin.000104 |          0 |
| dbbin.000105 |          0 |
| dbbin.000106 |          0 |
| dbbin.000107 |          0 |
| dbbin.000108 |          0 |
| dbbin.000109 |          0 |
| dbbin.000110 |          0 |
| dbbin.000111 |          0 |
| dbbin.000112 |          0 |
| dbbin.000113 |          0 |
| dbbin.000114 |          0 |
| dbbin.000115 |          0 |
| dbbin.000116 |          0 |
| dbbin.000117 |          0 |
| dbbin.000118 |          0 |
| dbbin.000119 |          0 |
| dbbin.000120 |          0 |
| dbbin.000121 |          0 |
| dbbin.000122 |          0 |
| dbbin.000123 |          0 |
| dbbin.000124 |          0 |
| dbbin.000125 |          0 |
| dbbin.000126 |          0 |
| dbbin.000127 |          0 |
| dbbin.000128 |          0 |
| dbbin.000129 |          0 |
| dbbin.000130 |          0 |
| dbbin.000131 |          0 |
| dbbin.000132 |          0 |
| dbbin.000133 |          0 |
| dbbin.000134 |          0 |
| dbbin.000135 |  928716703 |
| dbbin.000136 |  959380747 |
| dbbin.000137 |  851723423 |
| dbbin.000138 |  365674634 |
| dbbin.000139 | 1073742052 |
| dbbin.000140 |  123579443 |
| dbbin.000141 |   30362973 |
| dbbin.000142 |  902470948 |
| dbbin.000143 |  889738300 |
| dbbin.000144 |  923650782 |
| dbbin.000145 | 1511748108 |
| dbbin.000146 |  290317434 |
| dbbin.000147 |      52264 |
+--------------+------------+
278 rows in set (0.00 sec)

看着很不爽,进行下一步的解决:

mysql> purge binary logs to 'dbbin.000133';
Query OK, 0 rows affected, 263 warnings (0.01 sec)

查看处理的结果:

mysql> show binary logs;
+--------------+------------+
| Log_name     | File_size  |
+--------------+------------+
| dbbin.000133 |          0 |
| dbbin.000134 |          0 |
| dbbin.000135 |  928716703 |
| dbbin.000136 |  959380747 |
| dbbin.000137 |  851723423 |
| dbbin.000138 |  365674634 |
| dbbin.000139 | 1073742052 |
| dbbin.000140 |  123579443 |
| dbbin.000141 |   30362973 |
| dbbin.000142 |  902470948 |
| dbbin.000143 |  889738300 |
| dbbin.000144 |  923650782 |
| dbbin.000145 | 1511748108 |
| dbbin.000146 |  290317434 |
| dbbin.000147 |    3826433 |
+--------------+------------+
15 rows in set (0.00 sec)

再处理一下:

mysql> purge binary logs to 'dbbin.000135';
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> show binary logs;
+--------------+------------+
| Log_name     | File_size  |
+--------------+------------+
| dbbin.000135 |  928716703 |
| dbbin.000136 |  959380747 |
| dbbin.000137 |  851723423 |
| dbbin.000138 |  365674634 |
| dbbin.000139 | 1073742052 |
| dbbin.000140 |  123579443 |
| dbbin.000141 |   30362973 |
| dbbin.000142 |  902470948 |
| dbbin.000143 |  889738300 |
| dbbin.000144 |  923650782 |
| dbbin.000145 | 1511748108 |
| dbbin.000146 |  290317434 |
| dbbin.000147 |    4443351 |
+--------------+------------+
13 rows in set (0.00 sec)

看着是不是舒服很多?


网站名称:处理删除二进制日志后,showbinarylogs显示File_size为0的情况
分享地址:http://cqcxhl.cn/article/psigoj.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP