Restore a deleted MySQL database

Source: Internet
Author: User

Restore a deleted MySQL database

In the morning, I accidentally deleted a database I just created yesterday! Fortunately, the log feature is enabled in mysql.

The following describes how to restore a deleted database:

First, save the most recent binary log files as text files and export them. The command is as follows:

Mysqlbinlog F:/wamp/mysql-bin.000045> F:/test.txt

Second, open the saved txt file in the following format:

Here, at 1099 represents 1,099th commands (Let's note). query these commands to see where the command you want to reply is and then execute the command.

Finally, execute the reply Command, as shown below:

Mysqlbinlog -- start-position = "123" -- stop-position = "531" F:/wamp/mysql-bin.000045 F:/test.txt "mysql-uroot-p

In this way, you can complete the database reply !!!

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.