Mysql – How to know which binary log file to open for continous backup

backupbinlogMySQLmysqlbinlogrecovery

This really has me confused, I want to have point in time recovery so I plan to take occasional full database dumps, and then between those dumps I plan to use stop-never with mysqlbinlog. But I'm really confused on how I use each binary log file?

How do I know which one I'm meant to open when I start reading the binary log?

With stop-never do I have to keep switching binary log files when one is no longer used?

How do I find which log file contains a specific timestamp? Am I really supposed to just search each one? That sounds very inefficient.

Best Answer

You need them all. Or at least any that contain the "point in time" that you need, plus all that come after that file.

When one binlog gets "full" (according to a setting), it stops being written to, and another one starts.

FLUSH LOGS also stops the writing to one binlog and starts another. Presumably, your full backlog does such. That becomes the point at which you can toss all older binlogs.