The MySQL table is structured as an InnoDB type and restores data from the ibd file.

Source: Internet
Author: User

The MySQL table is structured as an InnoDB type and restores data from the ibd file.

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.

-------------------------------------- Split line --------------------------------------

Install MySQL in Ubuntu 14.04

MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF

Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL

Build a MySQL Master/Slave server in Ubuntu 14.04

Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS

Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04

-------------------------------------- Split line --------------------------------------

This article permanently updates the link address:

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.