Resolving MySQL Error 1195: Handling Crashed Tables and Failed Repairs

Encountering Error 1195 – SQLSTATE: HY000 (ER_CRASHED_ON_REPAIR) in MySQL indicates that a table has crashed and an attempt to automatically repair it has failed. This error commonly affects tables with the MyISAM storage engine, which is more prone to crashing, especially after an unexpected shutdown or hardware issues.

Understanding the Error

A crashed table means that the index file or the data file of the table is corrupted. MySQL tries to repair it automatically, but if it cannot, Error 1195 is reported. This can lead to data inaccessibility and potential data loss if not addressed properly.

Diagnosing the Problem

To begin diagnosing the issue:

  1. Identify the Crashed Table: The error message will include the name of the crashed table.
  2. Check MySQL Logs: The MySQL error log may contain additional information that can help understand the cause of the crash.
  3. Assess the Damage: Determine the extent of the corruption by running a check on the table.
   CHECK TABLE your_table_name;

Fixing the Error

Here are several methods to fix a crashed table in MySQL:

  1. Manual Table Repair:
    Use the REPAIR TABLE statement to manually repair the crashed table.
   REPAIR TABLE your_table_name;

If the automatic repair fails, you might need to use the USE_FRM option:

   REPAIR TABLE your_table_name USE_FRM;
  1. Use myisamchk Utility:
    For MyISAM tables, you can use the myisamchk command-line utility to repair the table. First, stop the MySQL server to prevent any write operations, then run:
   myisamchk --recover /path/to/data/dir/your_table_name

Replace /path/to/data/dir/ with the actual path to your MySQL data directory.

  1. Backup and Restore:
    If you have a backup, restore the table from the backup after dropping the corrupted table.
   DROP TABLE your_table_name;
   -- Restore from backup
  1. Incremental Recovery:
    If you have binary logs enabled, perform a point-in-time recovery up to the moment before the table crashed.
   mysqlbinlog --start-datetime="YYYY-MM-DD HH:MM:SS" /path/to/binlog-files | mysql -u username -p
  1. Switch Storage Engines:
    If you repeatedly encounter crashes with MyISAM tables, consider converting them to InnoDB, which is more crash-resistant.
   ALTER TABLE your_table_name ENGINE=InnoDB;
  1. Check Hardware:
    If crashes are frequent, perform hardware checks, as faulty hardware can cause table corruption.


Error 1195 (ER_CRASHED_ON_REPAIR) signifies a serious issue with a MySQL table that requires immediate attention. By following the above steps, you can diagnose the problem, repair the crashed table, and take proactive measures to prevent future occurrences. Regular backups and enabling binary logging are critical practices for data integrity and recovery.

For additional assistance and information on MyISAM table maintenance, you can refer to the MySQL documentation on MyISAM table repair.

Leave a Comment