MySQL Log recovery

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.