Close Menu
Techcolite
    Facebook X (Twitter) Instagram Pinterest
    • Contact Us
    • Privacy Policy
    • Cookie Policy
    • Disclaimer
    Facebook X (Twitter) Instagram Pinterest Tumblr
    TechcoliteTechcolite
    inmotionhostinginmotionhosting
    • Home
    • Tech News
      • Computers & Internet
      • Gadgets
      • Tablets & Mobiles
      • Web Hosting
      • Reviews
    • SEO
    • Software
    • WordPress
    • Business
    • Marketing
    • Off Topic
      • Tips & Tricks
    • About Us
    • Write for us
    • Contact Us
    Techcolite
    Home»Tips & Tricks»How to Repair a Crashed MyISAM Table
    Tips & Tricks

    How to Repair a Crashed MyISAM Table

    Team TechcoliteBy Team TechcoliteDecember 2, 2019No Comments6 Mins Read
    Facebook Twitter Pinterest LinkedIn Telegram Tumblr Email
    Share
    Facebook Twitter LinkedIn Pinterest Email

    How to Repair a Crashed MyISAM Table

    The discussion in this section describes how to repair a Crashed MyISAM table by using myisamchk on MyISAM tables (extensions .MYI and .MYD). Before moving towards the solution we must know about possible reasons for the corrupted MyISAM table.

    MyISAM Tables are corrupted due to a number of reasons and some of these are:

    • frm is locked and cannot be changed
    • Unable to locate file tbl_name.MYI (Errcode: nnn)
    • File ends unexpectedly
    • Record file crashed
    • Received error nnn from table handler

    For error stating ‘nnn’, you can get more information by running the command perror nnn, where nnn describes the error number. A few perror numbers and their explanations are:

    shell> perror 126 127 132 134 135 136 141 144 145

    MySQL error code 126 = Index file is crashed

    MySQL error code 127 = Record-file is crashed

    MySQL error code 132 = Old database file

    MySQL error code 134 = Record was already deleted (or record file crashed)

    MySQL error code 135 = No more room in record file

    MySQL error code 136 = No more room in index file

    MySQL error code 141 = Duplicate unique key or constraint on write or update

    MySQL error code 144 = Table is crashed and last repair failed

    MySQL error code 145 = Table was marked as crashed and should be repaired

    Above listed errors in MyISAM Tables can be fixed or repaired by using myisamchk repair method, with the exception of Perror 135 and 136 that cannot be fixed with this method. Such errors are caused due to space issues (no more room in record/index file) and are resolved by command Alter Tablespace, which increases maximum and average row length.

    ALTER TABLE tbl_name MAX_ROWS=xxx AVG_ROW_LENGTH=yyy;

    For errors listed in the table, use myisamchk or a MySQL Recovery Software to detect and fix MySQL database issues.

    Methods to Repair a Crashed MyISAM Tables

    The following repair methods are involved:

    1. Easy safe repair.
    2. Difficult repair.
    3. Very difficult repair.

    To decide the type of repair process, you need to check MyISAM tables by using the following steps:

    1. Run the command – myisamchk *.MYI or myisamchk -e *.MYI Suppress unnecessary information by suffixing –s (silent) option.
    2. If the server MySQLd is shut down, use –update-state option to mark the table as checked.

    You have to repair only those MyISAM tables for which myisamchk announces an error and starts from ‘Easy Safe Repair’ ’. However, if myisamchk lists unexpected errors (out of memory errors) or it crashes, try to repair the Tables by using difficult repair or a very difficult repair process.

    Note: Before starting the repair process, take a backup of the MySQL database to safeguard against data loss in case the repair process doesn’t work.

    1. Easy Safe Repair.

    • Start with quick recovery mode or –r –q commands. Type the following command to repair the index file. It doesn’t make any changes to the data file.

    myisamchk -r -q tbl_name (-r -q means “quick recovery mode”)

    • Verify the database to check if the file contains everything and ‘delete links’ point to correct locations within the data file. If it works, an easy repair process has fixed the Tables.
    • Repeat the process to repair the next Table.

    You can also repair MyISAM table using an alternative method:

    • Use myisamchk -r tbl_name (-r means “recovery mode”). This command helps remove incorrect rows and deleted rows from the data file and reconstructs the index file.
    • If you found that the above step fails, then use safe recovery mode – myisamchk –safe-recover tbl_name.

    Safe recovery mode is a slower method and uses an old recovery method to handle a few cases that regular recovery mode cannot.

    Note: You can accelerate MyISAM table repair operation by setting the values of sort_buffer_size and key_buffer_size variables each to 25% of the available memory.

    2. Difficult Repair.

    Difficult Repair is required only if the first 16KB block in the index file is destroyed, contains incorrect information, or index file is missing. Then it is necessary to create a new index file with the help of following steps:

    • Change the location of the data file and move it to a safe place.
    • Use the table description file to create new data and index files:
    1 shell> Mysql db_name

    This new data is empty.

    1

    2

    3

    mysql> SET autocommit=1;

    mysql> TRUNCATE TABLE tbl_name;

    mysql> quit

    • Copy and not move the content of the old data file back onto the newly created data file. (Retain a copy of old data in case something goes wrong).

    Note: In the case of file replication, stop the process prior to performing the above steps, as it includes file system operations that are not logged by MySQL.

    After successfully completion of process verify it by using myisamchk -r -q and if it works, then your MyISAM table is repaired. If not, repaired then follow the next method.

    3. Very Difficult Repair.

    Very difficult repair is required method in case the .frm description file has crashed. Normally, this file doesn’t crash, as the file is not changed after the table is created.

    The best option is to restore the description file from a backup. You can also restore the index file and go back to Easy Repair. But what if the database backup is not available. In the absence of a backup file, reconstruct the replica of the Table and create its copy in another database. Remove the new data file and then move the .frm description and .MYI index files from the other database to the crashed database. The newly constructed database provides new descriptions and index files but doesn’t contain .MYD data file.

    To reconstruct a new database, go back to Easy Repair and try to build the index file. It is the last manual method to repair MyISAM tables and hopefully, this should work.

    Sometimes these above manual methods don’t work. In such a condition you have relied on a Professional Tool.

    Conclusion

    This blog post highlights MyISAM errors and their probable causes. You can resolve a few errors by increasing the maximum and average row length but again, this is not the solution for all errors. The repair option requires changing the location of the database directory, checking the permissions of the Table file, and shutting down of MySQL server. Repairing with software eliminates the database-unavailability problem.


    Discover more from Techcolite

    Subscribe to get the latest posts sent to your email.

    Follow my blog with Bloglovin
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Team Techcolite
    • Website
    • Facebook
    • X (Twitter)
    • Pinterest
    • LinkedIn

    Techcolite is about Latest Technology news, Gadgets, Computers, Internet, SEO, Marketing and anything related to day to day technology.

    Related Posts

    7 Must-Have Azure DevOps Tools & Project Life Cycle Tips

    October 13, 2025

    15 Steps You Can Take Right Now To Boost Your LinkedIn

    September 26, 2025

    7 Simple Design Tips to Make Your Business Stand Out

    September 6, 2025

    What is Outlook EML File Location?

    August 12, 2025

    Import MBOX Files to Gmail Account- 2 Top Techniques

    August 5, 2025

    Easy Solution to Convert OLM to PST Without Outlook

    July 16, 2025
    Leave A Reply Cancel Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    • Facebook
    • Twitter
    • Pinterest
    • Instagram
    • Tumblr
    • Mastodon
    InmotionhostingInmotionhosting
    bluehostbluehost
    Advertisement
    LiquidwebLiquidweb
    Site1223Site1223
    Join 1000+ Subscribers

    Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    hubspothubspot
    About Techcolite

    TechColite.com is a dynamic tech blog offering in-depth insights and analysis on the latest trends in technology, gadgets, software, and digital innovations. With a focus on providing accessible yet comprehensive content, TechColite covers a wide array of topics, including AI, cloud computing, cybersecurity, app development, and emerging tech. Whether you’re a tech enthusiast, a developer, or a business leader, TechColite delivers expert reviews, tutorials, and industry news to keep you informed and ahead of the curve. The blog is dedicated to helping readers navigate the fast-paced world of technology with clarity and confidence.

    Partners
    DMCA.com Protection Status

    Web Safety

    BOSS

    techcolite.com

    Free of toxic links

    Approved by Sur.ly

    2022

    Discover latest Indian Blogs
    Mastodon
    Listed On
    Copyrighted.com Registered  Protected
    “Top
    DMCA Compliance
    Copyright Notice

    © Techcolite.com, 2015 to 2025. Unauthorized use and/or duplication of this material without express and written permission from this site’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Techcolite.com with appropriate and specific direction to the original content.

    Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.

    To find out more, including how to control cookies, see here: Cookie Policy
    Facebook X (Twitter) Instagram Pinterest Tumblr
    • Contact Us
    • Privacy Policy
    • Cookie Policy
    • Disclaimer
    Copyright © 2025 All Rights Reserved. Techcolite.com.

    Type above and press Enter to search. Press Esc to cancel.