How we can Repair MyISAM table crash in MySQL using Commands

MyISAM is that the default storage engine coming back with MySQL installations and normally used. we are able to encounter the crash issue because of several reasons like memory, server crash, improper development, etc. we are able to find it with the subsequent error entering into MySQL log files:

[ERROR] /usr/sbin/mysqld: Table 'table_name' is marked as crashed and may be repaired

You won’t be able to run any info queries and therefore the error log gets flooded at "/var/lib/mysql/" by default. we are able to resolve it by victimisation the subsequent commands:

1.  Login to MySQL and check the table with:

mysql> CHECK TABLE table_name;

here you need to replace the table_name with the actual name

If there are no crash issues, you will be getting an OK status in the output.

2. If there is a crash problem, attempt to repair it with the following command:

mysql> REPAIR TABLE table_name;

3. In most of the cases, this will work without any additional parameters. Sometimes, we get an error that the index file (.MYI) is missing or too corrupted to repair. In such cases, you can use the table definition file to repair it as described below:

mysql> REPAIR TABLE table_name USE_FRM;

4. If this does not fix the problem, we can repair the table with an external tool. Exit from the MySQL client and stop the MySQL server service:

#service mysqld stop

5. Now run the myisamchk command as follows:

#myisamchk /var/lib/mysql/mydatabase/table_name.MYI

If the data_dir variable in “/etc/my.cnf” is changed, point the command parameter as per the changes are done.

6. If you are getting errors, repair the index file by:

#myisamchk --recover /var/lib/mysql/mydatabase/table_name.MYI

Depending on the extent of the corruption, the time for the process varies, so please wait until its done.

7. Now restart the MySQL server service:

#service mysqld start

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

DDOS and DNS A Records Need Why ?

It is required that all DDOS shared hosting clients use Rivalhost Global Protected Name-servers...

Can you change my PHP version?

All new shared hosting accounts are created on a server which runs php version 5.3.x or higher We...

Do you host adult sites or content?

Yes we have Offshore Server also Offshore/ anonymous location . you can host / or runs any type...

Can I have multiple domains point to the same website?

Yes. These are commonly referred to as "parked domains" and allow you to have multiple domain...

How long does it take for my account to be setup?

Generally, it will not take more than 24 hours for us to setup your account, unless we have...