How to Resolve Error 122 from Storage Engine in MySQL?

Storage engine is a component in MySQL Server that reads, modifies, or deletes data in the database. MySQL Server includes two different storage engines - MyISAM and InnoDB. The MySQL error 1030, also called the code ER_GET_ERRNO, is an error related to the storage engine. The complete error message is like:

Error: 1030 SQLSTATE: HY000 (ER_GET_ERRNO)

Message: Got error 122 from storage engine

To get complete description of this error, you can use the MySQL utility perror. When you execute perror, you will get the following response:

Error code 122: Disk Quota Exceeded

It clearly says that there is a disk space issue. Now, you know the reason. Let’s see how to fix this error.

Solutions to Fix MySQL Error 1030: Got Error 122 from Storage Engine

Here are some solutions you can try to fix this error.

Check Disk Space

As you are experiencing a disk space issue, it is suggested to immediately stop working on MySQL to prevent corruption of the database. Now, check if disk quota is managed on your system. If this is the case, try disabling this feature. Also, check if there is enough space on the disk.

Fix Corrupted Database

This type of issue sometimes leads to database corruption because the storage engine is unable to write properly to the disk. In this case, you can try to fix the corruption issues using the internal commands that the MySQL provides.

Use CHECK TABLE Command

You can verify if a table is corrupted by using the CHECK TABLE command as given below:

CHECK TABLE /name_of_the_myisam_table [ , table2, table3, ..][option] /name_of_the_myisam_table

You can also specify an optional parameter in command, such as FOR UPGRADE, QUICK, FAST, MEDIUM, EXTENDED, or CHANGED. For example:

CHECK TABLE /name_of_the_myisam FAST QUICK; /name_of_the_myisam

2. Use MyISAMCHK Command

You can try to repair a corrupted table in the database by using the MyISAMCHK command. It will get the information about the MYISAM table. This is the syntax:

MyISAMCHK [option] < NAME_OF_THE_MYISAM_TABLE>

By specifying the –recover (or –r) option in the command, you can try to perform data repair in a table. This command can fix any problem except the problems related to unique key. Here is the syntax:

MyISAMCHK –r /name_of_the_myisam_table /name_of_the_myisam_table

Now, repeat the same procedure for the entire corrupted tables.

Note: It is suggested to take a backup of your database before using this command. Also, you must stop MySQL Service before executing data repair.

An Alternative Solution

When there are many damaged tables in the database, the repair operation using the MyISAMCHK commands becomes long and time-taking. In addition, MyISAMCHK commands can also fail in some situations. In such cases, you can use a third-party MySQL repair tool, such as Stellar Repair for MySQL. This MySQL recovery tool, developed by Stellar, is very effective in repairing corrupted MySQL database.

Some key features of this powerful, yet easy-to-use software are:

  • Repairs corrupted MySQL database
  • Repairs MySQL database tables of both the storage engines - InnoDB and MyISAM
  • Repairs MySQL and Maria DB databases created on Windows and Linux
  • Fixes all types of MySQL corruption errors
  • Saves repaired files in several format - MySQL, Maria DB, SQL Script, CSV, HTML, and XLS

Conclusion

Above, we have discussed in detail about the MySQL error 1030: Got error 122 from storage engine.We have also seen how to fix this error using the internal commands that MySQL provides.In case the database is corrupted, we suggest you use a dedicated MySQL database recovery tool, like Stellar Repair for MySQL.This powerful tool can repair corrupted database and recover all the data. You can download the free trial version of the software to evaluate its features and functionality.



Was this article helpful?
About The Author
author image
Bharat Bhushan linkdin Icon

Technical Marketer at Stellar Information Technology Private Limited. He makes Tech concepts easy to understand with his strong grip on Technology.

Table of Contents

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