0

MySQL binary logs are not purging automatically after binlog_expire_logs_seconds. However if I run mysqladmin flush-logs, it purges binary logs created before binlog_expire_logs_seconds.

MySQL server version is 8.0

1 Answer 1

1

Binary logs don't actually remove files immediately when the expiration period is reached.

Expiration happens when the binary logs start a new file. At that time MySQL Server checks if any of the old files are older than the expiration period. It deletes those files. So if your binary log is growing slowly enough that it doesn't roll over to a new file, then older files could stick around longer than the expiration period. The next time a new file is started, the old ones will be removed.

When you run FLUSH LOGS, this causes the binary log to close the current file and start a new file. This triggers the check for old files that need to be expired.

I would guess it's working correctly, but you miscalculated your expiration period.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.