I had a table with 62 Millions records with total size on disk as 1.2 GB.
What i was doing was joining this table with other table having 80 thousand records.
While running the query the MySQL server showed me an error
ERROR 126 (HY000): Incorrect key file for table
The problem behind thisĀ was related to the size of the temp directory, there was not enough memory on the drive where the temp directory was located.
SOLUTION
Try to change the location of the MySQL tmp directory to a place where there is lots of space. you can do this by editing the MySQL config file and adding this entry
tmpdir=”/path/to/the/temp/directory”

















Quick and to the point and saved me a ton of time. Thanks for posting!
Thanks Jeff