Question

I'm trying to do a partial mysqlbinlog on the latest binary log file at a certain position therein (trying to extract just one query).

mysqlbinlog --start-position=1234 --stop-position=1234 /var/lib/mysql/mysql-bin.000021

The output contains:

Warning: this binlog is either in use or was not closed properly.

How do I force MySQL to start logging in the next binlog file (i.e. mysql-bin.000022) and release the original file so I can use mysqlbinlog it?

Is there another solution to this problem?

Was it helpful?

Solution

You can use FLUSH LOGS to rotate the binlog before it reaches max size.

OTHER TIPS

If you already know the position of the query in question, there's no reason you can't mysqlbinlog an open binlog. Sure you won't see anything that gets added to the log after you open it, but you can pipe it through less and search for the query.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top