Here is a simple demonstration of how to purge MySQL binary logs.
The default value of the variable
expire_logs_daysis 10 days. MySQL
expire_logs_daysis a dynamic variable so we can edit it while MySQl is up & running, we don’t need to restart the server.
First check your slave status:
Now check to see the binary logs:
In my case, I want a retention of 5 days so I can start by deleting from
Eventually set the new value for
expire_logs_daysand don’t forget to edit your
Now see the reflection.
Again, once the parameter is changed in memory, change the my.cnf parameter accordingly
so that the instance doesn't startup with old parameter in next instance reboot.
Purging Binary Log with Date Range:
We can also binary logs with date & time range.