O'Reilly logo

MySQL 8 Cookbook by Karthik Appigatla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Expire binary logs

Binary logs consume a lot of space based on the number of writes. Leaving them as-is can fill up the disk in no time. It is essential to clean them up:

  1. Set the expiry of logs using binlog_expire_logs_seconds and expire_logs_days.If you want to set an expiry period in days, set expire_logs_days. For example, if you want to delete all the binary logs that are older than two days, SET @@global.expire_logs_days=2. Setting the value to 0 disables automatic expiry. If you want to have more granularity, you can use the binlog_expire_logs_seconds variable, which sets the binary log expiration period in seconds. The effects of this variable and expire_logs_days are cumulative. For example, if expire_logs_days is 1 and binlog_expire_logs_seconds ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required