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

Managing the binary logs

In this section, managing the binary logs in a replication environment is covered. Basic binary log handling is already covered in Chapter 6, Binary Logging, using the PURGE BINARY LOGS command and expire_logs_days variable.

Using those methods is unsafe in a replication environment because if any one of the slaves has not consumed the binary logs and you have deleted them, the slave will go out of sync and you'll need to rebuild it.

The safe way to delete the binary logs is by checking which binary logs have been read on each slave and deleting them. You can use the mysqlbinlogpurge utility to achieve this.

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