MySQL Database Repair

How to Fix MySQL Error 145?


Table of Content

    Summary: When the MySQL error 145 occurs, you’re not able to access data in the database. In this post, we will see how to fix the error 145 in MySQL. We’ll also mention a MySQL database repair application that can help fix the error by repairing the corrupt database.

    Read full summary

    MySQL, developed by Oracle, is nowadays one of most popular database management systems (DBMS). It is written in C/C++ language and is an open-source software. You can access the data stored in the database using the SQL language. In fact, MySQL supports ANSI/ISO SQL standards.

    Like any other DBMS, where software operates by reading and writing data on disk, data may get corrupt or damaged in MySQL.

    The common causes that can result in data corruption or damage in MySQL include:

    • Sudden system shutdown due to a power failure.
    • Virus or malware infection.
    • Hardware malfunction, such as disk failure or network failure.
    • Software malfunction, such as software bug in the MySQL engine.

    When the MySQL database gets corrupted, the data stored in the database becomes inaccessible and you’ll encounter the MySQL error code 145.

    Let’s discuss how to fix the MySQL error code 145 and recover the data.

    Methods to Fix MySQL Error 145

    It is said that prevention is the best solution. Therefore, it is always recommended to make copies of the data (backup) and verify that these are working fine (test restore). In case of such errors or data corruption, you can rely on the backups to restore the data.

    However, if you cannot count on a backup, then follow the given methods.

    Method 1: Use MySQL Tools

    MySQL provides some commands that allow you to restore the data. However, you must be careful while executing these commands as a small error can make the entire database unreadable. Always remember to make a copy of the data first.

    You can use the myisamchk command, if your database uses MyISAM tables (and not the newer InnoDB tables). This command will get information about the tables.

    To use this command, you need to specify an option followed by the table name (see below).

    myisamchk [options] <tablename>

    Many options are available but by specifying the -recover option, you can perform repair on a single table. You can also type “–r” instead of “–recover”.

    This will fix any problem, except problems related to unique keys that are not unique due to a problem.

    You can type:

    Myisamchk –r < tablename >

    Note: Stop the MySQL service before recovering a table.

    After the recovery process, you can check if the table is fine. To perform this operation, you can use the check table command as given below.

    Check table <tablename> [, tablename2, etc. etc.] ... [option]

    The parameter option may have the following values: FOR UPGRADE, QUICK, FAST, MEDIUM, EXTENDED, or CHANGED.

    For example, you can type:

    Check table <mytable> FAST QUICK;

    Method 2: Use a MySQL Database Repair Software

    If the recovery is not possible with the above MySQL tools, then you can use a powerful MySQL database repair software, such as Stellar Repair for MySQL, especially developed to recover data from corrupt MySQL databases. Here are its key features:

    • Fixes corrupt MySQL database and restores all its objects.
    • Recovers and saves tables, primary keys, views, triggers, etc. without modifying or deleting the original database.
    • Supports MySQL 8.0.30 and lower versions, including MariaDB up to 10.8.
    • Repairs InnoDB and MyISAM tables of MySQL database.
    • Repairs MySQL and MariaDB databases created on Windows or Linux.
    • Saves repaired files in MySQL, MariaDB, SQL Script, CSV, HTML, and XLS formats.

    Steps to use the Stellar Repair for MySQL

    • Download the application directly from Stellar’s website.
    • When the executable, named StellarRepairforMySQL.exe, is in your download folder, double-click on it. Then, follow the wizard to install the application. It will take only a few minutes.
    • Then, launch the software.
    Stellar Repair for MySQL interface

    On the main window, you need to enter the path of the folder which contains database files. After that, press the OK button.

    path for Database files
    • If data files are in use, you’ll get a warning message saying, MySQL service must be stopped before proceeding with the recovery process.
    MYSQL service

    A list of databases is shown. Press the Repair button.

    Database List
    • When the databases are repaired, you’ll get the repair complete message.
    Preview of Repair Database
    • Press the Save button.
    Saving Database
    • Choose in which format you want to save your recovered data. By default, the format selected is MySQL. Other formats such as MariaDB, HTML, SQL Script, CSV, and XLS are also available.
    • Enter Host Name, Username, and Password, and press the Save button.
    Saving Database type
    • At the end of the procedure, the following message will appear.
    Completion of Database

    To Conclude

    Error 145 in MySQL may occur due to corruption in the database. You can use the native MySQL utilities to repair the database and fix the error. Alternatively, you can use the Stellar Repair for MySQL software, to repair the corrupt database. This application is quite powerful and extremely easy to use.

    Was this article helpful?

    No NO

    About The Author

    Bharat Bhushan linkdin

    Bharat Bhushan is an experienced technical Marketer working at Stellar Data Recovery - expertise in data care. He is skilled in Microsoft Exchange Database, MSSQL Database troubleshooting & data warehousing. He is a Management Post Graduate having a strong grip in Technology & certified in SAP-SD, Oracle 10g & Informatica Powercenter 9.1.

    Leave a comment

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

    Image Captcha
    Refresh Image Captcha

    Enter Captcha Here :

    Related Posts

    WHY STELLAR® IS GLOBAL LEADER

    Why Choose Stellar?

    • 0M+

      Customers

    • 0+

      Years of Excellence

    • 0+

      R&D Engineers

    • 0+

      Countries

    • 0+

      PARTNERS

    • 0+

      Awards Received