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: http://techpolesen.blogspot.com/2007/06/problems-with-file-upload-into-m... "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: http://bugs.mysql.com/bug.php?id=12291 "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."