Pro-Test MySQL table structure for InnoDB type recover data from IBD files

Source: Internet
Author: User

Customer's machine system abnormal shutdown, after restarting the MySQL database does not start normally, after reloading the system found that the database file corruption, sad is that the customer database is not backed up in time, can only find ways to recover from the database files, find data, test various methods, confirm the following steps feasible:

OneRetrieve the table structure if the table structure is not lost directly to the next
A, first create a database, this database must be no table and any operations.
B. Create a table structure that is the same as the name of the table to be restored. The fields in the table don't matter. It must be innodb the engine. CREATE TABLE ' Test' (' TestID ' bigint ()) Engine=innodb DEFAULT Charset=utf8;
c, turn off MySQL, service mysqld stop;
d. Overwrite the newly created frm file with the frm file that needs to be restored;
e, modify My.ini Innodb_force_recovery=1, if not modified to 2,3,4,5,6.
F. Start Mysql,service mysqld start;show CREATE TABLE Testyou can see the table structure information.

Second, retrieve data

      A, set up a database to create a table based on the SQL execution of the table that was exported above.
      B, locate the record point. The current database table space should be discarded, so that the current IBD data files and frm separation.   ALTER TABLE test DISCARD tablespace;
      c, copy the. ibd file that you want to restore to the new table structure folder. Causes the current IBD and frm to have sex. ALTER TABLE test  import tablespace;

D. Export the recovered data to the right

Pro-Test MySQL table structure for InnoDB type recover data from IBD files

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.