How to repair a crashed MySQL table?

How to repair a crashed MySQL table?

You can experience various corruption-related errors while accessing MySQL database after a system crash. One of the examples is below:

“I am working on a MySQL database named EmployeesA, which contains important information related to the organization's departments. But due to sudden power failure, MySQL crashes. When I tried to access the tables from database. It shows error” Table is marked as crashed and should be repaired.”

In this scenario, you cannot open or access your tables in MySQL database file with the specified message. It can occur due to various reasons. Corruption is one of the major reasons behind this issue. To fix this, first you are required to check the InnoDB/MyISAM tables for corruption. In this article, we will discuss the methods to repair a crashed MySQL table. Before proceeding, let’s first understand the causes behind crashed MySQL database tables.

 

Causes of crashed MySQL table:

The MySQL tables fail to respond or crash due to a number of reasons like

- Your system becomes out of space.
- Storage devices where the MySQL database is saved have some issues.
- The system shut down while working on the tables in MySQL.
- Software bugs on your MySQL Server.
- Your application suddenly stopped.

 

Check Crashed MySQL table for corruption

If you face any scenarios which indicate the crashed table in the error message, first check that MySQL table for corruption. You can use the SQL-based command CHECK TABLE command or a command-line utility, mysqlcheck, to check tables for corruption. These commands can help you check the crashed MySQL tables for corruption errors. The CHECK TABLE command checks only specific tables in the MySQL database. To check the partitioned tables using CHECK TABLE, you are required to add an Alter statement in it. Here is the syntax:

CHECK TABLE tbl_name [, tbl_name] ... [option] ...

option: {

    FOR UPGRADE

  | QUICK

  | FAST

  | MEDIUM

  | EXTENDED

  | CHANGED

}

To run mysqlcheck Utility to check MyISAM table, here is a syntax:

mysqlcheck [options] db_name [tbl_name ...]

Insert –check in place of options.

 

Methods to repair a crashed MySQL Table:

1-Use the mysqlcheck utility

If your server is running, then you can use the mysqlcheck utility to repair the MySQL table. It uses the REPAIR TABLE statement. The syntax is

mysqlcheck [options] db_name [tbl_name ...]

Write --repair to repair the tables using mysqlcheck utility.

2-Use Dump and Reload method

If your server is not running and your tables are created in InnoDB engines, then use the force-recovery option to enable the server. Here are the steps to do so:

- Go to the configuration file on your system. The configuration file (my.cnf) is usually present in this /etc/mysql/my.cnf. Path on your windows. Once you locate to it, then change the value of innodb_force_recovery=1 and then restart your MySQL. After this, you would be able to access your crashed or corrupted table. Next, you can utilize the dump and reload method to rebuild the corrupt MySQL tables.

- The command to dump the table is below:

mysqldump -u user -p database_name table_name > single_dbtable_dump.sql

- Next, export all the databases to the dump.sql file by executing the below command.

mysqldump --all-databases --add-drop-database --add-drop-table > dump.sql

- Restart the MySQL Server and then use the DROP DATABASE command to drop the database.

Once you are done with this, go to the same configuration file and then comment the innodb_force_recovery value to #. Save and restart the application and your system.

3-Use Myisamchk command

If the corrupt table is created in MyISAM engine then repair the MySQL table using myisamchk command. First, stop the MySQL Server and execute the below command:

myisamchk –recover TABLE-Name

Once the table is recovered, restart the server.

 

Easy Method to repair crashed MySQL Table-Use a Professional MySQL Repair tool

To ease the process of recovering MySQL tables, you can use Stellar Repair for MySQL. It is an advanced MySQL data recovery tool that helps you repair and recover all data from MySQL tables in various situations like hard-drive failure, system crash, etc. Apart from this, it can even recover deleted data from both InnoDB and MyIsam tables. The tool also supports data repair in the Linux operating system. It can help resolve various issues associated with corruption in any of the objects in MySQL database.

 

Conclusion

When the MySQL tables are corrupted, damaged, or inaccessible after any disaster, you can run the repair methods discussed in the above article. Innodb_force_recovery mode can help you open the database while the MySQL server is not responding. However, if you want a single reliable tool to repair both InnoDB and MyISAM tables with complete integrity, then use a professional MySQL repair tool. The Stellar Repair for MySQL is one of the expert choices for repairing and recovering data in MySQL tables quickly and accurately.

Subscribe to our Newsletters

Sprintzeal

Sprintzeal

Sprintzeal is a world-class professional training provider, offering the latest and curated training programs and delivering top-notch and industry-relevant/up-to-date training materials. We are focused on educating the world and making professionals industry-relevant and job-ready.

Trending Posts

Top 10 Data Visualization Tips for Clear Communication

Top 10 Data Visualization Tips for Clear Communication

Last updated on May 31 2024

What is Data Integration? - A Beginner's Guide

What is Data Integration? - A Beginner's Guide

Last updated on Nov 7 2022

Big Data Uses Explained with Examples

Big Data Uses Explained with Examples

Last updated on Oct 11 2022

What is Big Data – Types, Trends and Future Explained

What is Big Data – Types, Trends and Future Explained

Last updated on Feb 2 2024

5 Popular Data Science Careers That Are in Demand

5 Popular Data Science Careers That Are in Demand

Last updated on Aug 29 2025

Hadoop Framework Guide

Hadoop Framework Guide

Last updated on Apr 3 2023

Trending Now

Big Data Uses Explained with Examples

Article

Data Visualization - Top Benefits and Tools

Article

What is Big Data – Types, Trends and Future Explained

Article

Data Science vs Data Analytics vs Big Data

Article

Big Data Guide – Explaining all Aspects 2024 (Update)

Article

Data Science Guide 2026

Article

Data Science Interview Questions and Answers 2024 (UPDATED)

Article

Power BI Interview Questions and Answers (UPDATED)

Article

Data Analyst Interview Questions and Answers 2024

Article

Apache Spark Interview Questions and Answers 2024

Article

Top Hadoop Interview Questions and Answers 2024 (UPDATED)

Article

Top DevOps Interview Questions and Answers 2025

Article

Top Selenium Interview Questions and Answers 2024

Article

Why Choose Data Science for Career

Article

SAS Interview Questions and Answers in 2024

Article

How to Become a Data Scientist - 2024 Guide

Article

How to Become a Data Analyst

Article

Big Data Project Ideas Guide 2024

Article

What Is Data Encryption - Types, Algorithms, Techniques & Methods

Article

How to Find the Length of List in Python?

Article

Hadoop Framework Guide

Article

What is Hadoop – Understanding the Framework, Modules, Ecosystem, and Uses

Article

Big Data Certifications in 2024

Article

Hadoop Architecture Guide 101

Article

Data Collection Methods Explained

Article

Data Collection Tools - Top List of Cutting-Edge Tools for Data Excellence

Article

Top 10 Big Data Analytics Tools 2024

Article

Kafka vs Spark - Comparison Guide

Article

Data Structures Interview Questions

Article

Data Analysis guide

Article

Data Integration Tools and their Types in 2024

Article

What is Data Integration? - A Beginner's Guide

Article

Data Analysis Tools and Trends for 2024

ebook

A Brief Guide to Python data structures

Article

What Is Splunk? A Brief Guide To Understanding Splunk For Beginners

Article

Big Data Engineer Salary and Job Trends in 2024

Article

What is Big Data Analytics? - A Beginner's Guide

Article

Data Analyst vs Data Scientist - Key Differences

Article

Top DBMS Interview Questions and Answers

Article

Top Database Interview Questions and Answers

Article

Power BI Career Opportunities in 2025 - Explore Trending Career Options

Article

Career Opportunities in Data Science: Explore Top Career Options in 2024

Article

Career Path for Data Analyst Explained

Article

Career Paths in Data Analytics: Guide to Advance in Your Career

Article

A Comprehensive Guide to Thriving Career Paths for Data Scientists

Article

What is Data Visualization? A Comprehensive Guide

Article

Data Visualization Strategy and its Importance

Article

Top 10 Best Data Science Frameworks: For Organizations

Article

Data Science Frameworks: A Complete Guide

Article

Fundamentals of Data Visualization Explained

Article

15 Best Python Frameworks for Data Science in 2026

Article

Top 10 Data Visualization Tips for Clear Communication

Article

How to Create Data Visualizations in Excel: A Brief Guide

ebook

Top PySpark Interview Questions and Answers for 2025

Article

5 Popular Data Science Careers That Are in Demand

Article

Top Data Warehouse Interview Questions to Crack in 2025

Article

Data Modeling Interview Questions and Answers 2025

Article