For MySQL, each step will have a corresponding record, such as insert,update,delete, DROP, alter and other related DDL or DML operations. Sometimes it's hard to make mistakes, but how to recover the data when something goes wrong.
For example, you now have this data:
But I was truncate. Emergency recovery is required.
First, make sure the Binlog output is turned on
Then, locate the current log file, using show master status such as:
After that, copy out the log file,
You can use: Show Binlog events in ' binlog.000001 ' to see the phase half range, or you can use Binlog to find
After that, flush logs[can generate a new log file],reset master "Delete all log Files"
Then, use the Mysqlbinlog--vv--base64-output=decode-rows to find the operating interval to recover:
Finally, use Mysqlbinlog recovery, such as: Mysqlbinlog--start-position=10468--stop-position=10680/tmp/binlog01 | mysql-uroot-p123456.
End.
Also refer to: http://www.cnblogs.com/martinzhang/p/3454358.html.
MySQL Log recovery