One innodb data recovery instance

Source: Internet
Author: User

During the weekend, developers used a machine for testing and installed a one-click installation package lnmp. As a result, I got rid of the mysql-server installed on the original rpm on this machine, but I don't know how they got it, the files stored in/var/lib/mysql by mysql-server are damaged, and the data in the table cannot be found. after logging in locally, I found that there is no mysql database. I can continue to view the table, and the table is displayed, but the data in the table cannot be found. after reading the error log, it is reported that you do not have the permission to access the table. After contacting the person responsible for maintaining the machine in Beijing on Monday, the result is as follows: no backup, no binary logs, and no engine used. This machine was handed over to the developers on our side without special instructions, and the Development did not know that it ran mysql. There is no way to solve this problem. check carefully in the/var/lib/mysql directory to make sure that the engine is innodb, the shared database file is still there, the table structure file is still there, and the redolog is still there. Fortunately, the problem is not big. Follow these steps to restore the database:

1. Restore the configuration file of the original database, including the log size file path.

2. Add innodb_force_recovery = 4 in the [mysqld] section.

3. Create a new database and create a table with the structure of the original table.

4. Copy the. frm table file created in the previous step to the database to be restored.

5. Start the database

6. Stop the database and comment out innodb_force_recovery = 4 items

7. Restart the database and use mysqldump to export data.

The key to restoring the table structure file with your memory is that ibdata data is in good condition and exported SQL statements are re-imported into the database.

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.