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