We use cookies on this website. By using this site, you agree that we may store and access cookies on your device Read More Got it!
MySQL Repair 4 minute read

[Fix] MySQL is marked as crashed and should be repaired

Priyanka Chauhan
Written By
Priyanka Chauhan
Kuljeet Singh
Approved By
Kuljeet Singh
stellar calander
Updated on
January 31st, 2023

MySQL is an open source RDBMS backed by Oracle. It supports all platforms, for example, UNIX, Windows, and Linux. It is mostly associated with web apps and online publishing, but it is not restricted to that, and can be used in a wide range of applications. Its working model is a client-based server.

The core of MySQL is MySQL server that handles all of the database commands. MySQL server is available as a separate program for use in a client-server networked environment. Though it is installed on one machine as a library that can be linked to separate applications, it is capable of sending data to multiple locations. It allows data to be stored on and accessed over multiple storage engines. To improve performance and durability, it also can replicate data. And you are not required to learn new commands for MYSQL; you can access the MySQL database by using standard SQL commands.

Crashed Tables in MySQL

While using MySQL, users may experience an error stating that “MySQL table is marked as crashed and should be repaired.” This error can appear at any time, especially after a forced shutdown of MySQL database or due to the crash of the entire server. While the error may seem daunting, it can be resolved. MySQL can repairing the crashed tables by itself. You would need to follow a few simple steps to make that happen. 

Let’s discuss the possible reasons and MySQL repair methods for this error.

The cause behind the error

Low disk space could be a reason for MySQL table being marked as “crashed”. When you have low space on your disk, some of the tables in the database may get crashed. It usually happens when you get space issues on the part of the hard disk where your database is stored.

Often it gets difficult to identify the specific tables that are affected by the error. Before starting the repair process, thus, let us quickly take a look at how to identify the corrupted MySQL tables.

Identifying crashed MySQL tables

You can identify corrupted tables through certain expected and observable errors in the queries, for example:

  • Can’t find file tbl_name.MYI (Errcode: nnn)
  • Unexpected end of file
  • Got error from table handler
  • Record file is crashed
  • Can’t find file tablethatshouldbethere.MYI
  • tablethatwasworking.frm is locked against change
  • Got error ### from table handler.

You can run perror to get more information about the error

Recovering MySQL Crashed Tables

MySQL server provides its own tool to diagnose crashed tables. This tool is known as myisamchk, and you can use it as shown below:

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

Running this command will list the crashed MySQL tables, with a message as follows:

MyISAM-table '/var/lib/mysql/dbname/table_name.MYI' is marked as crashed and should be repaired

Other than diagnosis, the tool can also help you repair the damaged table. In most cases, the problem is solved by running the myisamchk command. But if it doesn’t solve the problem, try stopping your web service, so that no new requests are generated, stop the MySQLd daemon itself and run the below-given command:

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

The “–update-state” switch tells MySQL to mark the indicated table as “checked.” Once this has been done, restart your MySQLd and web service, and MySQL will repair the crashed table. As a result, the error will be removed, and your database will be safely restored.

Recovering database by using backup

Another way to deal with ‘MySQL table is marked as crashed and should be repaired’ error is to recover your database from a previously saved backup.

Having a solid backup strategy for your data is essential. It helps you recover the data when everything else goes wrong. Instead of searching the methods for repairing MySQL crashed tables, you can restore data instantly from a backup, and that will surely save your time. That’s why your database, install directory, and home directories should be backed up and tested regularly by using database administration or any backup tool of your choice.

Software tool for MySQL Database Repair

Stellar Repair for MySQL is a powerful and convenient tool for MySQL database repair, which can save time while doing the repair more effectively. So, it can be your default first choice.

Alternatively, you can use the software as a complementary solution to fill in for the manual method- if it doesn’t work, or if you don’t have the backup to restore your database.

It is available for a free trial download so that you can test it out for repairing your MySQL database files. The software recovers all the objects including keys, views, triggers, tables, etc., in their original format. It can repair InnoDB and MyISAM tables and allows us to save the MySQL repair database in various formats like MySQL, CSV, HTML, and XLS.

Free Download for Windows

To summarize

MySQL is one of the most trusted relational database management systems. But if you need to write queries in MySQL repair table or recover tables, you need to have deep technical knowledge about it. You cannot play around with MySQL without knowing the roots of it since that will increase the chances of you losing the data permanently.

So, if you don’t have hands-on proficiency on MySQL, a safer option is to recover the corrupt database by using the backup. Next, you can use the built-in myisamchk utilityfor the database repair.

A safer, convenient, and more effective MySQL database repair solution is offered by Stellar Repair for MySQL. It’s available for the free trial which offers to scan and preview the database so that you can ascertain the capabilities really well.

About The Author

Priyanka

Priyanka is a technology expert working for key technology domains that revolve around Data Recovery and related software's. She got expertise on related subjects like SQL Database, Access Database, QuickBooks, and Microsoft Excel. Loves to write on different technology and data recovery subjects on regular basis. Technology freak who always found exploring neo-tech subjects, when not writing, research is something that keeps her going in life.

Best Selling Products

Stellar Data Recovery Professional for Windows

Stellar Data Recovery Professional for Windows

Stellar Data Recovery has the right Windows Recovery tool for all your data recovery

Read More
Stellar Data Recovery Professional for Mac

Stellar Data Recovery Professional for Mac

Stellar Data Recovery for Mac program performs safe..

 

Read More
Stellar Photo Recovery

Stellar Photo Recovery

A comprehensive photo recovery software to restore photos, music & video files

 

Read More
Stellar Repair for Video

Stellar Repair for Video

Powerful video repair tool for repairing corrupt or damaged MOV and other video files

 

Read More

6 comments

  1. Ranjan Sharma says:
    October 21, 2019 at 10:18 am

    Great, the information seems to me work well, I will try it now.

    Reply
  2. Catty Heil says:
    October 16, 2019 at 5:38 am

    I migrate my database from PostgreSQL to MySQL it seems data get corrupted. Will this solution work in this situation?

    Reply
    1. Eric Simson says:
      October 16, 2019 at 9:30 am

      Yes, You can use Stellar Repair for MySQL.

      Reply
  3. Elias Leon says:
    September 19, 2019 at 5:01 am

    I used the in-built utility so many times but no benefits. Finally, I tried Stellar Repair for MySQL and yes its really works. Thanks, guys for such a great utility.

    Reply
    1. Eric Simson says:
      September 22, 2019 at 5:39 pm

      Hey Elias, Thanks for such nice words. We are happy to see our customers happy.

      Reply
  4. Tracy Dickinson says:
    August 25, 2019 at 12:43 pm

    In my case, I fixed this problem manually using the command:

    REPAIR TABLE “;

    But, the above command is not returning any outcome. HELP!

    Reply

Leave a comment Cancel reply

Your email address will not be published. Required fields are marked *

Image Captcha
Refresh Image Captcha

Enter Captcha Here :

Table of Contents    arrow

Categories

offer banner

Related Posts

related post
MySQL Repair

[Fixed] MySQL innodb_force_recovery is Not Working Properly

Stellar Author Charanjeet Kaur January 21, 2022 Read More
related post
MySQL Repair

How to Repair MySQL Database using phpMyAdmin?

Stellar Author Charanjeet Kaur November 11, 2021 Read More
related post
MySQL Repair

How to Repair MySQL Tables Using Mysqlcheck

Stellar Author Charanjeet Kaur July 17, 2021 Read More

Free Trial for 60 Days

Technology You Can Trust A Brand Present Across The Globe

  • tuv1
  • tuv2
  • Nist
  • hipa

Stellar Official Website

Stellar Data Recovery Inc.
48 Bridge Street Metuchen,
New Jersey 08840,
United States

ALSO AVAILABLE AT

ALSO AVAILABLE AT

About

  • About us
  • Career
  • ISMS Policy
  • Privacy Policy
  • Terms of Use
  • License Policy
  • Refund Policy
  • End User License Agreement

RESOURCES

  • Blog
  • Articles
  • Product Videos
  • Knowledge Base
  • Case Studies
  • Whitepapers
  • Software Catalog

NEWS & EVENTS

  • News
  • Events

PARTNERS

  • Affiliates
  • Resellers
  • Distributors

Useful Links

  • Contact Us
  • Support
  • Special Offers
  • Student Discounts
  • Awards & Reviews
  • Downloads
  • Store
  • Sitemap

Stellar & Stellar Data Recovery are Registered Trademarks of Stellar Information Technology Pvt. Ltd. © Copyright 2023 Stellar Information Technology Pvt. Ltd. All Trademarks Acknowledged.

Follow Us Facebook Twitter Linkedin Youtube

  • Notron
  • dcma