We are running mysql v5.6.17 and I cannot find if there is something else that is causing the binary logs to be purged other than the following:
- Adding
expire_logs_days
to the my.ini (and confirming it is set on the server viashow global variables like 'expire%';
) - Manually running PURGE BINARY LOGS
There is a nightly backup that backs up the main database, compresses it using 7zip and then FTPs it to another server. I found that the binary logs are purged every night to the binary log which was always created at 00:00 midnight. This is an issue as there is a replication machine running which uses GTIDs and it cannot find the binary logs on the master which are specified by the gtid_purged.
I created 2 events to troubleshoot this. The first event to turn on general logging into a table during this period where it was being purged, and a second to turn general logging off a few hours later. The backup starts at 00:05 and the purge is issued at around 00:07
It seems the PURGE MASTER LOGS TO
command was being run by root[root] @ localhost [::1].
There is no one connecting to the server that would run this.
As far as I understand the --delete-master-logs
in mysqldump command is similar to RESET MASTER
, but is not the same as PURGE BINARY LOGS
. We do not use --delete-master-logs
however.
What could be causing the purge?