MyISAM Table Damaged and Records Unreadable?
Recover MyISAM Data Files
Scenario Description
A MyISAM table is damaged or its instance is unavailable, but copies of MYD, MYI and definition files survive. MyISAM requires its own physical layouts and index evidence; an MYD file cannot be parsed as an IBD.
Possible Causes
- An abnormal shutdown damaged data or indexes.
- Only old MyISAM file copies survive.
- Dynamic-record chains or deleted regions are incomplete.
Challenges
Conventional recovery often requires complete files, a running instance or a usable backup. In these situations, choose a method based on the evidence that survives.
Common Errors and Symptoms
- - The table cannot be opened and queries or exports fail.
- - MYD/MYI files are readable but some record blocks are damaged.
- - Deleted prefixes or surviving content cannot be assumed to be complete rows.
Why Traditional Methods Fail
- - Index repair modifies evidence; preserve frozen copies first.
- - Mismatched FRM or DDL can cause incorrect interpretation.
- - Active rows require separate treatment from deleted or damaged content.
PDU Solution
PDU checks the MyISAM record layout using MYD, MYI, matching DDL and the exact version, then exports active rows that can be fully parsed. Deleted prefixes and damaged content are saved separately. Unfinished tasks can be resumed.
Recovery Principle
- Preserve Matching Evidence
- Inspect MyISAM Layout
- Parse Active Rows
- Save Results and Checkpoints
PDU Core Capabilities
- Use MyISAM-specific inspection and export commands.
- Resolve MYD, MYI and definitions together.
- Publish complete active rows separately.
- Keep deleted prefixes and damaged content quarantined.
- Retain original sources and task identity.
- Resume without rereading business output.
Recovery Steps
- 1
Initialization
Keep original file copies, definitions and output tasks separate. myisam uses a dedicated task; unload ibd does not parse MYD.
- 2
View Data Files and Table Definitions
Replace example version numbers and filenames with actual sources. Use - for missing FRM/SDI only when current-path schema-evidence requirements are met.
- 3
Parse the Data Files
unload takes no explicit task or output directory and reports MYISAM_TASK. Resume with that native task path from the original launch directory.
Complete active rows are exported separately. Record deleted prefixes, damaged content, conflicting field layouts and source I/O errors with their reasons rather than counting them as complete business records.
- 4
Continue the Recovery Task
Resume with the original task, files and parameters. MAX_NEW_UNITS can limit work units for a run as described in native help. A pause retains native checkpoints without declaring recovery complete.
Quick Command Examples
Preserve frozen sources and launch PDU outside them. Write configuration snippets to pdu.ini and execute PDU commands after startup. Replace example paths, versions, times and task identities with actual evidence.
# View Data Files and Table Definitions
myisam inspect /recovery-input/orders.MYD /recovery-input/orders.MYI /recovery-input/orders.sql 50744 /recovery-input/orders.frm;# Parse the Data Files
myisam unload /recovery-input/orders.MYD /recovery-input/orders.MYI /recovery-input/orders.sql 50744 /recovery-input/orders.frm;# Continue the Recovery Task
myisam resume /recovery-input/orders.MYD /recovery-input/orders.MYI /recovery-input/orders.sql 50744 <MYISAM_TASK> /recovery-input/orders.frm;Export Results
Table Data SQL
Exported data is saved directly in the directory where PDU was started, for example orders.sql. Larger results are split into orders_2.sql and subsequent files.
Table Definitions
Use unload ddl for directory-mode definitions; preserve the matching original DDL for single-file recovery.
Native Recovery Records
Internal tasks are stored in .pdu-work beneath the launch directory, retaining success, failure, errors and checkpoints.
After export, record PDU’s native success and failure counts and original errors, retaining checkpoints. Resume uses native records and file metadata without rereading exported data or automatic trial import.
Prerequisites
- Preserve MYD, MYI, DDL and available FRM/SDI from the same frozen source and record the exact version.
- FIXED/DYNAMIC use their own file layouts. InnoDB type and recovery claims do not apply automatically.
- Prepare a matching program, license and sufficient space. Keep original evidence read-only and place the PDU launch directory outside the sources.
Important Notes
- Files, definitions and the exact version must match; missing blocks cannot be recreated.
- Deleted prefixes are not complete committed business records and must remain separate from active rows.