You may encounter errors when trying to access/open the MyISAM tables. One such error is “Error 1194 – Table ‘tablename’ is marked as crashed and should be repaired.” This error means that there is an issue with the MyISAM table’s data stored in three files – table definition file (frm), MYD data file (.MYD), and index file (.MYI) – on the system’s disk. The MyISAM tables get corrupted due to a number of reasons. In this article, we’ll explore the common causes of corruption in MyISAM tables and explain how to safely repair MyISAM tables and resolve the error 1194.

Reasons for Corruption in MyISAM Tables in MySQL Server

MyISAM tables can get corrupted due to several reasons, such as:

  • Bugs in the MySQL or MyISAM code
  • System failure or crash 
  • Lack of storage space on the disk
  • Faulty hardware
  • Abnormal termination of MySQL service
  • Server crash due to insufficient memory on the system

Methods to Resolve MySQL Error 1194: Table Crashed

You may face the MySQL Error 1194: Table Crashed issue, if there is not enough space available on the hard drive where the MyISAM tables are located. You can check the available space by right-clicking on the disk and then selecting the Properties option. If the disk space is low, then free up the space. If there is sufficient free space on your system disk, then the issue might be due to corruption in MyISAM tables. You can follow the below methods to troubleshoot the issue.

Method 1: Restore Tables from the Backup File

If you have a readable backup of the MySQL database, then you can easily restore the crashed MySQL tables from the backup. You can use the mysqldump utility to restore the MySQL database from the dump file. Here’s how:

Note: Before using this utility, first make sure you have all the required privileges, such as SELECT, CREATE, SHOW VIEW, and TRIGGERS, on the backup file. 

  • Create an empty database to save the restored database by using the following command:

mysql > create db_name

  • Next, use the mysqldump utility to restore the database. To do so, use the following command: 

mysql -u root -p db_name < dump.sql

  • This will restore all the objects in database. Now, you can use the following command to  check the MySQL tables:

mysql> use db_name;

mysql > show tables;

Method 2: Use the REPAIR TABLE Command

The REPAIR TABLE command can help you rebuild the MyISAM tables in MySQL. Here is how to use the REPAIR TABLE command:

REPAIR TABLE table name;

Alternatively, you can use the open source tool – phpMyAdmin with the XAMPP application for Windows to repair the tables. Here is how:

  • In the phpMyAdmin window, click the Databases option to display the listed MySQL databases. 
  • Select the corrupt database. You will see a list of all the tables in the selected database.
  • Click Check All to select and repair all the tables. Next, select the tables and then click on the With selected drop-down option, and then click on the Repair Table option
  • The phpMyAdmin will run the Repair Table query on the selected MySQL tables. Once the repair process is complete, a message – Database tables are repaired – will appear. 

Note: The Repair Table option using PhpMyAdmin may not give the desired outcome if you try to restore a large-sized database files. 

Method 3: Use myisamchk Command

You can run the myisamchk command to repair or rebuild the MyISAM tables. This command checks all the MyISAM tables and repairs MYD and MYI files in tables. To run the myisamchk command, follow the steps below:

  • First, stop the MySQL Server.
  • Then, use the following command to repair the MyISAM table:      

myisamchk –recover TABLE

  • Start the MySQL Server.

Note: This command doesn’t support repairing of partitioned tables.

Method 4: Use a Professional MySQL Repair Tool

If the above repair methods didn’t work for you or the size of database is too large, then you can use a professional MySQL repair tool, such as Stellar Repair for MySQL. It is a specialized tool that can quickly repair corrupt MySQL database of any size or in any state. Moreover, it helps you repair partitioned tables, indexes, foreign keys, etc., in the database with complete precision. It works on databases created in both InnoDB and MyISAM storage engines. It also helps resolve common errors and issues associated with corruption in MyISAM tables, including the error 1194.  

Key Features of Stellar Repair for MySQL:

  • Repairs corrupt or damaged MyISAM and InnoDB tables 
  • Recovers all the objects, like primary keys, unique keys, foreign keys, tables, relations, etc., from the damaged MySQL database
  • Supports selective recovery of MyISAM tables 
  • Saves recovered data in multiple file formats, including SQL Script, CSV, and HTML
  • Allows to save information of scanned MySQL database file to carry on the process later
  • Intuitive and user-friendly GUI
  • Supports MariaDB database up to 11.6
  • Compatible with all Windows versions, including Windows 11

Conclusion

The MySQL error 1194 – Table ‘tablename’ is marked as crashed and should be repaired can occur due to limited space on the system hard disk or corruption in MySQL database. By following the methods mentioned in this article, you can easily and effectively repair the corrupted MySQL database. A better option is to use a reliable MySQL repair tool, like Stellar Repair for MySQL. It can help you recover the tables and all other objects from the MyISAM tables without any data loss. You can save the recovered data in a new file with different formats.