Read time 4 minutes

MySQL is an open-source Relational Database Management System (RDBMS), which is written in C and C++ languages and supports multiple platforms, including Windows, Linux, macOS, UnixWare, etc. Various applications use it for data storage, online publishing, and web apps. Also, it is supported by Oracle.

It works based on the client-server model with MySQL Server as the server. You can store, access, or retrieve the data stored in the server anytime.

About the “MySQL is marked as crashed and should be repaired” error

In this article, we get a brief introduction to one of the common MySql errors- MySql is marked as crashed and should be repaired.

Table ‘./dbname/table_name’ is marked as crashed and should be repaired

The MySQL error “MySQL is marked as crashed and should be repaired” may occur suddenly while you are accessing MySQL. The frequency of the error is more after the forced shutdowns of the MySQL Server. Whatever the reason, you cannot access or use your MySQL tables anymore as it has completely crashed.

Reasons for the “MySQL is marked as crashed and should be repaired” error

While using MySQL, users sometimes face issues with the pop-up message, such as “MySql table is marked as crashed and should be repaired,” and this happens especially after an abrupt system shutdown. Less disk capacity is the reason MySQL tables are marked as crashed because due to less space, tables in the database might get damaged. Other reasons like high I/O wait on the disk, and heavy load on the server can also cause MySQL crashes.

How can one identify MySQL crashes?

One can identify this problem by specific error messages, which are as follows-

  • “Unexpected end of file”
  • “Record file is crashed”
  • “Can’t find file tbl_name.MYI (Errcode: nnn)”
  • “tablethatwasworking.frm is locked against change”
  • “Got error ### from table handler”
What is the immediate remedy? – Restore from backups

If you are a professional or a common MySQL Server user, you must have taken backups of the MySQL Server database files. With a recent backup of MySQL Server, it would be pretty easy to restore the whole database. But If you do not have backups for MySQL Server data, then you will have to find some other solutions on your own, which would take both effort and time. So, our suggestion is to take periodic backups of the MySQL database.

How to fix error “MySQL is marked as crashed and should be repaired” without backups?

Through myisamchk tool

Users can find the broken or crashed MySQL tables using the native tool provided by the MySQL application known as “myisamchk”.

Run this command on myisamchk command line.

# myisamchk -s /var/lib/mysql/*/*.MYI

It will list out the tables that are corrupted, and you will get to know where to make the fix.

Once you know the name of the tables that need repair, you can execute the following command.

# myisamchk -r /var/lib/mysql/dbname/table_name.MYI

In the above command, you need to provide the table name that was found out in the first command (broken or crashed).

If the table is not repaired yet, you can try another command. Before that, stop the web services, stop MySQLd, and then run this command.

# myisamchk -r –update-state /var/lib/mysql/dbname/table_name.MYI

Next, restart the MySQLd and the web services and check if the error is fixed.

Even after executing these commands in myisamchk application, it might be possible that you get an incomplete recovery or no recovery at all. But we are here to help you.

should be your next step? – professional third-party utility

If you want to recover the corrupt MySQL Server database completely and flawlessly, then you should go for a professional third-party utility that is reliable and efficient.

Here, we introduce you to the advanced Kernel for MySQL Database Repair tool for MySQL file recovery in very little time. It is designed with the latest technology and highly efficient programs to quickly fix all the corruption issues of MySQL database files and make the data accessible to the users.

It effectively repairs all the issues of the MySQL file and makes the inaccessible data available for preview. Now, you can select the required data and then save it to either MySQL Server directly or to a batch file. Moreover, the advanced tool is compatible with all MySQL Server and Windows Operating System versions.

Final words

MySQL database is popular among database users as it is open-source and is supported by Oracle. However, there are a few errors that make its data inaccessible. Here, we have discussed some manual solutions to fix one of the MySQL errors. And in case of an unsuccessful repair, we have suggested a professional tool at the end.

Kernel for MySQL Database Recovery