2
Incorrect key file for table '/tmp/#sql_185e_0.MYI'; try to repair it

What does this error mean?

"Incorrect key file for table '/tmp/#sql_185e_0.MYI'; try to repair it"

I'm inserting 400k records in a table by 25k per batch using PHP in command line. If I inserted only 1k records then it will not produce the MySQL error.

Does the error mean that my server has no more disk space?

Thanks.

OMG Ponies
  • 325,700
  • 82
  • 523
  • 502
marknt15
  • 5,047
  • 14
  • 59
  • 67

1 Answers1

2

According to google - this error often related to not enough space for the drive your temporary directory is located at.

zerkms
  • 249,484
  • 69
  • 436
  • 539
  • Thanks zerkms. It seems that the server's /tmp/ directory has no disk space left. These linux commands are useful in solving my error: fg, screen, ps -ef, free -m, top and df -lh. – marknt15 Oct 26 '10 at 01:15
  • Also, I added a PHP mysql_free_result($result) after my select statements to free some space :) Thanks – marknt15 Oct 26 '10 at 01:20
  • @marknt15: if you did not get fatal errors about not enough memory - then `mysql_free_result()` usage is not obligatory. I even would say it is pointless. – zerkms Oct 26 '10 at 01:28
  • the tmp folder has a limit usually 2GB, try df -h to see it – Elzo Valugi Jan 18 '12 at 12:09
  • I had an apache access.log take up my entire server HD space, and then rebooted. my tmp folder was then made 1MB. after removing the log file, rebooting, the tmp folder was the proper size and the error went away. – Zachary May 27 '18 at 18:28