MySQL: how to restore data from ibd files

Source: Internet
Author: User
When an independent table space is used, if you accidentally damage the metadata file ibdata of the innodb Storage engine, we can save valuable data because innodb uses an independent table

When an independent table space is used, if you accidentally damage the metadata file ibdata of the innodb Storage engine, we can save valuable data because innodb uses an independent table

When an independent tablespace is used, if the metadata file ibdata of the innodb Storage engine is damaged accidentally, we can save valuable data. when innodb uses an independent tablespace, The ibdata file records the id of each innodb table, as long as the table id in ibd is the same as that recorded in the ibdata file, you can open the table and read the data.

# Creating a table

Create table 'ibdtest '(

'Id' int (11) not null AUTO_INCREMENT,

'Fid' int (11) not null comment' id' in Table B ',

'Content' char (255) not null comment' operation content, system generated ',

'Mark' char (255) not null comment' COMMENT ',

Primary key ('id ')

) ENGINE = InnoDB default charset = utf8

# Add data

INSERT ibdtest (fid, content, mark) VALUES (1, '1', '1'), (2, '2', '2 ');

SELECT * FROM ibdtest;

Disable mysql and copy ibdtest. ibd to other databases to simulate disasters.

[Root @ localhost ~] #/Opt/soft/mysql/bin/mysqladmin-p123456 shutdown

120130 18:31:50 mysqld_safe mysqld from pidfile/opt/soft/mysql/60137. localdomain. pid ended

[1] + Done/opt/soft/mysql/bin/mysqld_safe -- defaults-file =/opt/soft/mysql/config/my. cnf -- user = mysql

,

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.