Shashi kumar S
Shashi kumar S

Reputation: 915

Expire bin log in minutes

In the mysql conf file my.cnf, I want to add expiry time for the bin-logs. After doing a quick research on that, I got to know how to set it for days.i.e., expire_logs_days=3.

I want to set the expiry time for every 5 minutes. Is it possible ? How to do that ? I tried expire_logs_minutes=5, but that didn't work.

Thank for any help.

Upvotes: 1

Views: 2366

Answers (2)

Flo Doe
Flo Doe

Reputation: 5381

There is actually a way to archive your wanted behavior, but you have to implement this via a cron job or similar thing, just execute:

PURGE BINARY LOGS BEFORE NOW() - INTERVAL 5 MINUTE;

Above will remove your binlog-files older than five minutes. See also the documentation: PURGE BINARY LOGS Syntax

Upvotes: 2

user1881277
user1881277

Reputation:

I don't think that is possible. If you need to expire it in 5 minutes, why do you need binlogs at all? You may disable it.

Upvotes: 0

Related Questions