After MySQL deleted ibdata1, how to restore the table structure through the. frm file

Source: Internet
Author: User

First, create a table test_0

CREATE TABLE ' te '. ' Test_0 ' (' ID ' INT (9) Zerofill not NULL, ' name ' VARCHAR (), PRIMARY KEY (' id ')) EN Gine=innodb;

Second, delete the following 3 files

Files directory : D:\Program files\mysql\mysql Server 5.5\data

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6C/DA/wKioL1VUXfXx2-XuAADXqGnHcQk947.jpg "title=" S.png " alt= "Wkiol1vuxfxx2-xuaadxqgnhcqk947.jpg"/>

Third, restart the database, and then The following issues occurred while accessing TEST_0

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6C/DB/wKioL1VUXzrCxw2PAAGALF1BoaA084.jpg "title=" T.png " alt= "Wkiol1vuxzrcxw2paagalf1boaa084.jpg"/>

At this time, the table can not be accessed, how, the table structure is not backed up, how can the table structure to restore it???

Iv. start preparing for the recovery table structure

    1. Recreate a innodb table, such as:

      create TABLE Test (' id ' BIGINT ()) ENGINE = INNODB;

    2. Close the MySQL server to D:\Program files\mysql\mysql server 5.5\data\te, delete the test.frm, and change the test_0.frm name to Test.frm

    3. Modify the My.ini file and add it under mysqld: innodb_force_recovery=6

    4. Start MySQL Server.

    5. To see the test table

      650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/M01/6C/DB/ Wkiol1vuynzztpqpaaeldtdrc6o016.jpg "title=" Q.png "alt=" wkiol1vuynzztpqpaaeldtdrc6o016.jpg "/>

    6. OK, now that the table structure of the test_0 is restored, and then, the table structure of the test is exported, and the name of the Create is changed to Test_0, then the

    7. Restored statement is as follows:

CREATE TABLE ' test_0 ' (' ID ' INT (9) UNSIGNED Zerofill not null, ' name ' VARCHAR () DEFAULT NULL, PRIMARY KE Y (' id ')) engine=innodb DEFAULT Charset=utf8

Note: If the table is less than the time, recovery can also, when the table more time, this method is more troublesome!!!

After MySQL deleted ibdata1, how to restore the table structure through the. frm file

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.