The structure of the Mysql table is InnoDB and data is restored from the ibd file. innodbibd

Source: Internet
Author: User

The structure of the Mysql table is InnoDB and data is restored from the ibd file. innodbibd

The customer's machine system is shut down abnormally. After the restart, the mysql database cannot be started normally. After the system is reinstalled, the database file is damaged. Sadly, the customer's database is not backed up in time, you can only find a way to recover from the database file, search for information, test the methods, and confirm the following steps are feasible:

1. Retrieve the table structure. If the table structure is not lost, go to the next step.
A. Create a database first. The database must have no tables or any operations.
B. Create a table structure with the same name as the table to be restored. The fields in the table do not matter. It must be the innodb engine. Create table 'test' ('testid' bigint (20) ENGINE = InnoDB default charset = utf8;
C. Disable mysql and service mysqld stop;
D. overwrite the newly created frm file with the frm file to be restored;
E. Modify innodb_force_recovery = 1 in my. ini. If it cannot be changed to 2, 3, 4, 5, 6.
F. start mysql and service mysqld start; show create table test to view the table structure information.

Ii. Data Retrieval

A. Create a database and execute the SQL statement to create a table based on the table created in the preceding export.
B. Find the Record Point. First, discard the tablespace of the current database to separate the data file of the current ibd from frm. Alter table test discard tablespace;
C. Copy the previously recovered. ibd file to the new table structure folder. Associate the current ibd with frm. Alter table test import tablespace;

D. Export the recovered data.


How to restore InnoDB data of MySQL database

If you install the same version of mysql database, there should be no problem. Therefore, first install the original version of the database, and then import the data into the text.
 
How can I restore the mysql innodb source file to the database? (The original database has deleted the database source files that only support innodb)

What files are left,
If the entire Innodb tablespace and the. frm table structure file of the corresponding database are all stored, you can try to restore it in the database directory ..

But basically it won't succeed.

Innodb table restoration is the most reliable form of Backup 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.