强制 MySQL 写入新的 binlog

Force MySQL to write to a new binlog

是否可以强制mysql开始将未来事件写入新的二进制日志文件? 在文档中提到最终事件是日志轮换事件,它提到了下一个日志的名称 filename 我们可以强制执行日志轮换事件吗?如果是,那又如何?

FLUSH [BINARY] LOGS 导致启动一个新的 binlog 文件。

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).