How to remove , purge or prune old mysql binary logs

How to remove , purge or prune old mysql binary logs

Asked on September 2, 2019 in MySQL.

I have followed the below process: 1 – Examine the binary logs to decide up to where you want to delete to:

ls -la /var/lib/mysql/

2 – Here the traffic to one server had suddenly increased and the server had been logging 101MB every few minutes for several days.

....
-rw-rw----  1 mysql mysql   104871967 Aug 24 00:01 BINLOG.015687
-rw-rw----  1 mysql mysql   104885618 Aug 24 00:04 BINLOG.015688
-rw-rw----  1 mysql mysql   104866713 Aug 24 00:06 BINLOG.015689
...

3 – You can either prune by date or by file. For simplicity, I pruned by file. You need to do this from the MySQL command line. I connected to mysql and ran the following command:

PURGE BINARY LOGS TO 'BINLOG.015689';

But i could also prune by date:

PURGE BINARY LOGS BEFORE '2013-08-24 00:06:00';

 

on September 2, 2019.
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.