Force MySQL to write to a new binlog

1.6k Views Asked by At

Is it possible to force mysql to start writing future events to a new binlog file? In the docs it is mentioned that the final event is a log-rotation event which mentions the name of the next log filename Can we force a log-rotation event? If yes, then how?

1

There are 1 best solutions below

0
Bill Karwin On BEST ANSWER

FLUSH [BINARY] LOGS causes a new binlog file to be started.

https://dev.mysql.com/doc/refman/5.7/en/flush.html

FLUSH BINARY LOGS

Closes and reopens any binary log file to which the server is writing. If binary logging is enabled, the sequence number of the binary log file is incremented by one relative to the previous file.

This operation has no effect on tables used for the binary and relay logs (as controlled by the master_info_repository and relay_log_info_repository system variables).