Home > Database > Mysql Tutorial > body text

如何安全删除mysql下的binlog日志

WBOY
Release: 2016-06-07 17:42:00
Original
1071 people have browsed it

最近发现mysql的binlog目录下的日志太多了,磁盘空间被占满了,导致网站访问不了。-rw-rw----1mysqlmysql1073742161May3120:51binlog.000021-rw-rw----1mysqlmys

最近发现mysql的binlog目录下的日志太多了,磁盘空间被占满了,导致网站访问不了。


-rw-rw---- 1 mysql mysql 1073742161 May 31 20:51 binlog.000021

-rw-rw---- 1 mysql mysql 1073742892 May 31 22:41 binlog.000022

-rw-rw---- 1 mysql mysql 1073741876 Jun  1 00:30 binlog.000023

-rw-rw---- 1 mysql mysql 1073741892 Jun  1 02:19 binlog.000024

-rw-rw---- 1 mysql mysql 1073742650 Jun  1 04:08 binlog.000025

-rw-rw---- 1 mysql mysql 1073742008 Jun  1 05:57 binlog.000026

-rw-rw---- 1 mysql mysql 1073743194 Jun  1 07:46 binlog.000027

-rw-rw---- 1 mysql mysql 1073743161 Jun  1 09:34 binlog.000028

-rw-rw---- 1 mysql mysql 1073741891 Jun  1 11:23 binlog.000029

-rw-rw---- 1 mysql mysql 1073742841 Jun  1 13:11 binlog.000030

-rw-rw---- 1 mysql mysql 1073744077 Jun  1 15:00 binlog.000031

-rw-rw---- 1 mysql mysql 1073744098 Jun  1 16:49 binlog.000032

-rw-rw---- 1 mysql mysql 1073743330 Jun  1 18:38 binlog.000033

-rw-rw---- 1 mysql mysql 1073746020 Jun 14 16:20 binlog.000034

-rw-rw---- 1 mysql mysql 1073743436 Jun 15 19:26 binlog.000035

-rw-rw---- 1 mysql mysql  247808012 Jun 18 11:25 binlog.000036

-rw-rw---- 1 mysql mysql   20455501 Jun 18 16:11 binlog.000037

-rw-rw---- 1 mysql mysql     694690 Jun 18 16:44 binlog.000038

-rw-rw---- 1 mysql mysql    4366694 Jun 18 18:28 binlog.000039

-rw-rw---- 1 mysql mysql  192837775 Jun 21 13:28 binlog.000040

-rw-rw---- 1 mysql mysql   26720306 Jun 21 13:50 binlog.000041

-rw-rw---- 1 mysql mysql 1073741956 Jun 21 14:56 binlog.000042

-rw-rw---- 1 mysql mysql 1073742382 Jun 21 15:39 binlog.000043

-rw-rw---- 1 mysql mysql 1073755643 Jun 21 17:41 binlog.000044

-rw-rw---- 1 mysql mysql 1073745037 Jun 22 18:30 binlog.000045

-rw-rw---- 1 mysql mysql 1073745820 Jun 23 17:16 binlog.000046

-rw-rw---- 1 mysql mysql  768790035 Jun 24 12:30 binlog.000047

-rw-rw---- 1 mysql mysql 1073742672 Jun 24 15:11 binlog.000048

-rw-rw---- 1 mysql mysql 1073751254 Jun 24 16:20 binlog.000049

-rw-rw---- 1 mysql mysql 1073743150 Jun 24 17:38 binlog.000050

-rw-rw---- 1 mysql mysql 1073745450 Jun 24 19:03 binlog.000051

-rw-rw---- 1 mysql mysql 1073742107 Jun 24 20:30 binlog.000052

-rw-rw---- 1 mysql mysql 1073743107 Jun 24 22:33 binlog.000053

-rw-rw---- 1 mysql mysql 1073745069 Jun 25 01:35 binlog.000054

-rw-rw---- 1 mysql mysql 1073757980 Jun 25 09:13 binlog.000055

-rw-rw---- 1 mysql mysql 1073750646 Jun 25 13:43 binlog.000056

-rw-rw---- 1 mysql mysql 1073749126 Jun 25 20:09 binlog.000057

-rw-rw---- 1 mysql mysql  332813390 Jun 25 22:22 binlog.000058

-rw-rw---- 1 mysql mysql       2106 Jun 25 20:09 binlog.index


解决方法如下:

第一种方法:

mysql> show binary logs;  查看mysql bin-log日志,除了这个以外的,其它都可以使用删除。

mysql> purge binary logs to 'binlog.000058';  (删除mysql bin-log日志,删除binlog.000005之前的,不包括binlog.000058)

第二种方法:

进入数据库,香港服务器,查看一下当前使用的binlog日志是哪个,除了这个以外的,香港服务器,其它都可以使用rm -rf 删除!


本文出自 “Linus_hai” 博客,服务器空间,请务必保留此出处

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!