General error: 126 Incorrect key file for table

Saw this error in Magento admin:
SQLSTATE[HY000]: General error: 126 Incorrect key file for table '/tmp/#sql_7397_0.MYI'; try to repair it

Solved it by increasing the tmp directory space on the MySQL server.

Here's an example of someone fixing the error by increasing their tmp directory: "Incorrect key file for table '/tmp/#sql_4108_0.MYI'; try to repair it. After some digging around I found out it was due to /tmp on my Linux virtual host being only 32MB and mysql seems to use a temporary MyISAM table when inserting large binary data. When there wasn't enough space in /tmp for the temporary table, mysql failed. I fixed this by setting "tmpdir = /var/tmp" (which has lots of space on my host) in my.cnf"

Also here: "Upon further observation I determined that the error I got was the result of a temporary table getting so large that it filled TMPDIR, generating the above error."


Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Each email address will be obfuscated in a human readable fashion or (if JavaScript is enabled) replaced with a spamproof clickable link.

More information about formatting options

This question tests whether you are a human visitor, to prevent automated spam submissions.
Question text provided by