Home > Database > Mysql Tutorial > Can I Recover MySQL Table Structure Using FRM and IBD Files Without IB_Log Files?

Can I Recover MySQL Table Structure Using FRM and IBD Files Without IB_Log Files?

Patricia Arquette
Release: 2025-01-07 19:11:42
Original
622 people have browsed it

Can I Recover MySQL Table Structure Using FRM and IBD Files Without IB_Log Files?

Restore MySQL table structure from FRM and IBD files (without IB_Log file)

After losing the IB_log file, database data recovery seems to be tricky. However, the database table structure can still be restored using FRM and IBD files.

Here are the recovery steps:

1. Extract SQL creation statement:

  • Install the MySQL Utilities tool and use the mysqlfrm command.
  • Execute the mysqlfrm --diagnostic command on each FRM file to obtain the SQL statement used to create the table.

2. Rebuild the table structure:

  • Execute SQL statements to recreate the table and, if necessary, delete the old table.

3. Delete new data:

  • Execute the ALTER TABLE example_table DISCARD TABLESPACE command to eliminate the connection between the new FRM and IBD files.

4. Replace and import data:

  • Replace the new IBD file with the old IBD file from the backup.
  • Execute the ALTER TABLE example_table IMPORT TABLESPACE command to import the original data and restore the table contents.

The above is the detailed content of Can I Recover MySQL Table Structure Using FRM and IBD Files Without IB_Log Files?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template