Home/Blog/How to Fix MySQL ‘Table Is Marked as Crashed’ Error (2026)

How to Fix MySQL ‘Table Is Marked as Crashed’ Error (2026)

Cracked database table icon with repair tools and warning triangle

Your site throws “Table ‘./dbname/table_name’ is marked as crashed and should be repaired” (MySQL error 145/1034), and every query touching that table fails. This MySQL table marked as crashed fix guide explains what happened: the table’s index or data files were left in an inconsistent state — usually after an unclean shutdown, a power cut, a full disk, or the server process being killed mid-write. The good news: for MyISAM tables this is routine and repairable; for InnoDB the engine usually self-heals on restart. This 2026 guide covers both.

First, identify which storage engine you are dealing with — the repair path differs completely. Run SHOW TABLE STATUS LIKE 'your_table'\G and read the Engine row. MyISAM tables crash visibly and repair with REPAIR TABLE or myisamchk; InnoDB tables rarely show this message, and when they do, the fix is crash recovery via the error log, not a repair command. Back up before you touch anything — a failed repair on a production table without a backup is how bad days get worse.

What Causes a MySQL Table to Crash

  • Unclean shutdown: power failure, kill -9 on mysqld, or a server crash mid-write — the classic trigger.
  • Disk full: MySQL cannot finish writing index updates when the disk hits 100%.
  • Hardware faults: bad RAM or failing disks corrupting pages as they are written.
  • MyISAM’s design: MyISAM is not crash-safe — unlike InnoDB it has no transaction log to replay, so any interruption can mark tables crashed.
  • Concurrent access bugs: external programs writing to MyISAM files while mysqld is running.

How to Fix a Crashed MySQL Table: 7 Steps

Step 1: Confirm the damage with CHECK TABLE

Connect via mysql -u root -p, select the database, and run CHECK TABLE your_table; (or CHECK TABLE your_table EXTENDED; for a deep scan). The Msg_text column tells you the verdict: OK (healthy), error/corrupt/crashed (needs repair). Note the exact table name from the original error message.

Step 2: Repair MyISAM tables with REPAIR TABLE

For MyISAM, the online fix is: REPAIR TABLE your_table;. If that reports it cannot fix the table, escalate: REPAIR TABLE your_table EXTENDED; rebuilds the index row by row (slower, more thorough), and REPAIR TABLE your_table USE_FRM; rebuilds from the .frm definition when the index file is beyond saving. Verify afterwards with CHECK TABLE again.

Step 3: Use myisamchk for offline repair

When the server cannot repair it online, go offline: systemctl stop mysql, then myisamchk -r /var/lib/mysql/dbname/your_table.MYI. For stubborn cases use myisamchk --safe-recover, or myisamchk -r --update-state to mark the table checked. Restart MySQL afterwards. Never run myisamchk on files while mysqld is using them.

Database administrator repairing a damaged MySQL table with tools

Step 4: Repair via phpMyAdmin (no SSH)

On shared hosting, open phpMyAdmin, select the database, tick the crashed table, and choose “Repair table” from the “With selected” dropdown — or run REPAIR TABLE your_table; in the SQL tab. If your host denies the privilege, open a ticket: they can run it in seconds.

Step 5: Handle InnoDB differently

REPAIR TABLE does nothing useful for InnoDB. Instead, read the MySQL error log for the underlying fault, then if the server will not start, add innodb_force_recovery = 1 under [mysqld] in my.cnf and restart — raising the level (1–6) only as far as needed to dump the data with mysqldump. Remove the setting and restart after recovery; leaving it on risks silent data loss.

Step 6: Restore from backup if repair loses rows

Check row counts after repair (SELECT COUNT(*)) against your last known good numbers. If rows are missing or the table will not repair, restore that table from your most recent backup into a scratch database first, verify it, then swap it in. This is why automated daily backups exist — set them up before the next crash. For the broader outage scenario, see our database connection error guide.

Step 7: Find all other damaged tables

One crashed table often means siblings are damaged too. Scan everything: myisamchk -s /var/lib/mysql/*/*.MYI (offline) or mysqlcheck -u root -p --check --all-databases (online). Repair each hit, then investigate the root cause in the error log — repeated crashes point at disk, RAM, or power issues, not bad luck.

How to Prevent Crashed Tables

  • Convert critical MyISAM tables to InnoDB (ALTER TABLE t ENGINE=InnoDB;) — transactional crash safety ends this class of error.
  • Monitor disk space with alerts at 80% and 90% full.
  • Use a UPS on bare-metal servers; enable graceful shutdown on VMs.
  • Run automated daily backups and periodically test a restore.
  • Never kill -9 mysqld; always stop it via the service manager.

Conclusion

A crashed table is MySQL’s way of saying “my files don’t add up” — CHECK TABLE to confirm, REPAIR TABLE or myisamchk for MyISAM, log-driven recovery for InnoDB, and backups as your safety net. Fix the root cause too, or you will be repairing the same table again next month. For more database rescue guides, browse the KamiWeb blog.