I have a binary log that mysqlbinlog chokes on with the error in the title.

The file itself has much more activity after the cited position.

Doing some basic confirmation it's not all garbage by running it through the strings command shows theres legit traffic until the end of the file when it got rotated.

I've seen a similar post about using hexdump to get past an error related to event too large, but in my case mysqlbinlog chokes to continue to get further information. I'm not familiar enough with the binary format to look for what might be a position of a next event it would recognize.

It gives a starting position it can't get past so I have a script running to basically mysqlbinlog --start-position=X incrementing X by one until it returns with a 0 exit code but that looks like it's going to take a month to completely get through everything at this rate.

I tested the POC of this idea on "good parts" by starting it at weird offsets and it returned correctly at the next one it found w/o error.

I'm running percona 5.6.20 for this instance.

I realize this report might be lacking in information needed to answer the question so I'm happy to edit with comment requests as needed.

1 Answer 1


Well much to my surprise the script I mentioned did find a good starting position and I was able to successfully recover a large portion of the binary log after the problem point.

Not the most elegant script but in case it's of use to anyone else. Note it is very slow restarting a new process to scan byte by byte but got me results.

And yes I recognize the potential of infinite looping by never finding anything, might want to add additional check based on start position vs filesize


while [ $RET -eq 1 ]; do
    # This is relying on the mysqlbinlog found in your path
    # You'll want to make sure this resolves to a binary version matching the mysqld that generated the binlog
    mysqlbinlog --start-position=$START $BINLOG > /dev/null 2>&1

    START=$(( START + 1 ))
    if [[ $(( START % 1000 )) -eq 0 ]]; then
        echo $START


# Saving it to a file in case youre running it overnight, script is very slow.
echo $GOODSTART > ${BINLOG}.goodstartposition

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.