How to Restore MySQL Data from .FRM and .IBD Files?
If your MySQL database is corrupted or accidentally deleted, but the .frm and .ibd files remain, recovery is still possible. This article shows how to restore a MySQL database from .frm and .ibd files, including preparing the environment, importing tablespaces, fixing InnoDB issues, and verifying recovered data.
About .FRM and .IBD Files
In MySQL, each table is stored on disk as one or more physical files that work together to define the table and store its data. Among these files, .frm and .ibd play a critical role in how MySQL manages table structures and data storage.
What Is a .FRM File?
A .frm file stores the table structure, such as: Table name; Column names; Data types (INT, VARCHAR, etc.); Primary keys and indexes
👉Think of it as the blueprint of a table.Without the .frm file, MySQL doesn’t know how the table is defined.
What Is an .IBD File?
An .ibd file is used by the InnoDB storage engine and contains the actual data, including: Table records (rows) and Index data.
👉Think of it as the warehouse where the table’s data is stored. If the .ibd file is missing, the table structure may exist, but the data is gone.
Relationship Between .FRM and .IBD
| File | Purpose | Required |
| .frm | Table structure definition | Yes |
| .ibd | Table data and indexes | Yes (InnoDB tables) |
When Do You Need to Restore MySQL Data from .FRM and .IBD Files?
Before jumping into the recovery steps, it’s important to understand when and why you may need to restore MySQL data from .frm and .ibd files. This situation usually occurs when logical backups are unavailable, but the original table files still exist.
- Accidental database or table deletion: The database is dropped, but the table files remain on disk or in a backup directory.
- MySQL server crash or disk failure: A system crash damages the MySQL data directory, making tables inaccessible even though .frm and .ibd files still exist.
- Operating system reinstallation or migration errors: MySQL is reinstalled or moved to a new server without proper logical backups.
- Corrupted InnoDB tables: Tables appear in MySQL but cannot be opened, showing errors related to missing or mismatched tablespaces.
- Missing or outdated backups: No .sql dump is available, leaving .frm and .ibd files as the only remaining data source.
In these cases, restoring MySQL tables from .frm and .ibd files may be the only practical way to recover your data.
How to Restore MySQLData from .FRMand .IBDFiles?
The following method applies to InnoDB tables and requires that the .frm and .ibd files come from the same original table.
Step 1: Prepare a Clean MySQL Environment
First, install the same MySQL version that was used on the original server whenever possible. Using an identical or very close version helps avoid tablespace and compatibility issues during recovery. Before performing any file operations, completely stop the MySQL service to prevent file locking or further corruption.
Next, check the MySQL configuration file (my.cnf or my.ini) and confirm that the innodb_file_per_table option is enabled. This setting ensures that each InnoDB table uses its own .ibd file, which is required for importing tablespaces. If you make changes to the configuration, restart MySQL to apply them.
Step 2: Create an Empty Table with the Same Structure
After MySQL is running normally, recreate the database where the table will be restored. Once the database exists, create an empty table using the exact same structure as the original one. The table definition must match precisely, including column order, data types, index definitions, storage engine, and character set.
Even small differences in the table structure can cause the tablespace import to fail. After creating the table, verify that it contains no data to ensure it is ready for recovery.
Step 3: Remove the Newly Created .IBD File
Stop the MySQL service again after the empty table is created. Navigate to the database directory inside the MySQL data folder and locate the .ibd file that was automatically generated for the new table.
Delete this newly created .ibd file, as it will be replaced by the original one. Do not remove the .frm file, since it defines the table structure needed for the import process.
Step 4: Copy the Original .IBD File
Copy the original .ibd file into the same table directory where the deleted file was located. Make sure the file name matches the table name exactly. Then adjust file ownership and permissions so they match other MySQL data files, ensuring MySQL can access the file without permission errors.
Step 5: Import the Tablespace
Start the MySQL service and connect to the database. Run the following SQL command to import the tablespace:
ALTER TABLE table_name IMPORT TABLESPACE;
MySQL will attach the original .ibd file to the table and attempt to restore the data. If the command completes successfully, the table data should become accessible immediately.
Step 6: Verify the Restored Data
Finally, run basic SELECT queries to confirm that the data has been restored correctly. Check the number of rows and test key indexes to ensure the table behaves as expected. Once verification is complete, it is strongly recommended to back up the recovered data as soon as possible.
FAQs about MySQL Files
Q1. How Do .FRM and .IBD Files Affect MySQL Table Recovery?
.FRM files define the table structure, including columns, indexes, and table properties, while .IBD files store the actual table data and indexes. If either file is missing or corrupted, MySQL cannot access the table. Understanding these files is crucial for any recovery attempt, and tools like MyRecover can simplify restoring both .FRM and .IBD files safely.
Q2. Can I Recover a MySQL Table If I Only Have .FRM and .IBD Files?
Yes, it is possible to restore the table by carefully importing the original .IBD file into a new table with the same structure. However, this process can be tricky, and any mismatch in table definitions or file permissions can cause errors. For users looking for a safer solution, professional tools like MyRecover can help automate the recovery of MySQL files from damaged or deleted directories.
Q3. What Causes MySQL Files to Become Corrupted or Lost?
Common causes include accidental table or database deletion, server crashes, disk failures, improper migrations, or MySQL misconfigurations. Even if the database seems gone, the .FRM and .IBD files may still exist and serve as a source for recovery.
Q4. How Can I Safely Recover MySQL Data Without Causing More Damage?
Manually copying .IBD and .FRM files is risky because any misstep can overwrite data. Using a reliable recovery tool like MyRecover ensures that deleted, lost, or corrupted MySQL files can be safely restored while preserving table integrity. MyRecover supports scanning the disk and recovering InnoDB tables, even if the database is no longer visible in MySQL.
Q5. Is There a Way to Prevent MySQL Data Loss in the Future?
Yes, regular backups are essential. Use logical backups (mysqldump) or physical backups (copying the entire MySQL data directory safely). Additionally, enabling innodb_file_per_table ensures that each InnoDB table has its own .IBD file, simplifying recovery.
Summary
Recovering MySQL data from .FRM and .IBD files can seem challenging, but understanding the role of these files and following a careful restoration process makes it achievable. By preparing a clean environment, recreating table structures accurately, and importing the original tablespaces, you can restore lost or corrupted InnoDB tables safely.
👍👍Professional Data Recovery Software Recommendation: MyRecover
When it comes to recovering lost, or deleted files without any backup, MyRecover comes in as a professional data recovery solution. It is capable of restoring over 1,000 different file types across more than 500 data loss scenarios.

- ✔️Diverse Data Loss Scenarios- Handles 500+ data loss scenarios covering all types of deletions and logical damage.
- ✔️Broad File Format Support - Recovers 1000+ file types including documents, photos, videos, htmls, archives and etc.
- ✔️Wide Storage Devices- Restore files from internal/external HDD/SSD, USB flash drive, SD card, Camera, PS4/5, drone, CCTV, music/video players, etc.
- ✔️Intuitive Interface - User-friendly design requires no technical expertise to operate.
- ✔️Selective Recovery - Previews found files before restoration for precise recovery.
- ✔️High Success Rate - Industry-leading recovery performance for both recent and long-deleted files.
- ✔️Safe Operation - Read-only process ensures your original data remains protected.