Restore MySQL table structure using only .frm and .ibd files
Question:
If there is no ib_log file, can I restore the structure of the MySQL table using only the .frm and .ibd files?
Answer:
Table structure can be restored from *.frm files. Please follow these steps:
Step 1: Retrieve SQL Create Query
mysqlfrm --diagnostic <path>/example_table.frm
Get SQL query. (please replace <path>
with your *.frm file path) Step 2: Create table
Step 3: Prepare for data recovery
ALTER TABLE example_table DISCARD TABLESPACE;
Step 4: Recover Data
chown -R mysql:mysql *.ibd
ALTER TABLE example_table IMPORT TABLESPACE;
This process will recover table structure and data from .frm and .ibd files.
The above is the detailed content of Can MySQL Table Structure Be Recovered Using Only .frm and .ibd Files?. For more information, please follow other related articles on the PHP Chinese website!