So many answers are above and the question owner already got the solution as suggested by @Hawili, and a long time has been passed since this problem was raised. But as this a common issue, I wanted to share my experience so that if someone got this issue again due to different reasons then can get solution from here.
Case 1:
Most common reason is that a query is fetching data greater than the size of your /tmp partition. Whenever you get this issue during a query, look at your /tmp folder size. Temporary tables are created and removed automatically, and if available space here gets down to 0 during this query it means either you need to optimize your query or need increase /tmp's partition size.
Note: Sometimes it isn't an individual query: if a combination of heavy queries do this at the same time on the same server then you can get this issue, where normally the individual queries would execute without any error.
Case 2:
In case of a corrupt myisam table where you need to repair, the directory path will be different than /tmp in the error message.
Case 3: (rare case)
Sometimes due to an incorrect table join you can get this error. This is actaully a syntax error but mysql can throw this error instead. You can check details here at below link-
Incorrect key file for table '/tmp/#sql_18b4_0.MYI'; try to repair it