handling mysql binlog data
eagletree at hughes.net
Fri May 2 15:36:40 UTC 2008
On May 2, 2008, at 5:27 AM, Zbigniew Szalbot wrote:
> Following a recent thread I would like to ask if it is safe to
> remove old binlog data. From the below I understand that the
> current binlog is mysql-bin.000007 and the previous ones (from
> 000001-000006) are not written to any more. I just need
> confirmation before I take any action. By asking whether it is
> safe, I only mean if deleting them will not affect mysql operation.
> I do backups of mysql data anyway.
> -rw-rw---- 1 mysql mysql 61956466 Apr 16 08:44 mysql-bin.000001
> -rw-rw---- 1 mysql mysql 697756219 Apr 17 14:26 mysql-bin.000002
> -rw-rw---- 1 mysql mysql 1056 Apr 17 14:29 mysql-bin.000003
> -rw-rw---- 1 mysql mysql 1073745860 Apr 24 05:49 mysql-bin.000004
> -rw-rw---- 1 mysql mysql 620489997 Apr 27 10:48 mysql-bin.000005
> -rw-rw---- 1 mysql mysql 229357379 Apr 28 15:55 mysql-bin.000006
> -rw-rw---- 1 mysql mysql 869964294 May 2 14:15 mysql-bin.000007
> Do I understand correctly that removing mysql-bin.000007 would
> result in mysql not writing any data to mysql-bin file until the
> server gets restarted?
I recently removed all logs prior to the one shown as current
without any problems. I would not think you would want to
remove the one currently in use or problems would result.
The procedure for this is here:
for 5.1 and here:
Simply doing an rm on the files you know are no longer in use
is probably not a good idea because they are known within mysql
data files. Using the above will make sure they are removed in
an orderly manner. According to the docs, if you use the process
as shown, the active file will be skipped even if you accidently
try to remove it.
> Many thanks for sharing!
> Zbigniew Szalbot
More information about the freebsd-questions