I have this in my.cnf:

tmpdir = /dev/shm

and I'm getting this in my error logs:

[23-Apr-2011 10:22:08] WordPress database error Incorrect key file for table '/dev/shm/#sql_30f1_0.MYI'; try to repair it for query  SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish')  ORDER BY RAND() DESC LIMIT 0, 5 made by require, require_once, include, get_posts, WP_Query->query, WP_Query->get_posts

The file size is very large - over 3 GB in size, but there are other tables in that directory getting the same error are 1024 bytes - not sure what is going on here

How do I try to repair a temp table? I'm getting this error A LOT!


PS on a separate note - anybody know where in thewordpress core this call is being made? I haven't been able to track it down - I want to disable it because of the ORDER BY RAND() call in it.

1 Answer 1


/dev/shm is shared memory. That will compete with OS for available RAM. You simply do not have enough RAM to hold that large temp table.

You need to comment out that line in /etc/my.cnf


and restart mysql. That way, tmpdir default to the OS tmp folder, which is /tmp. That will put temp tables on disk.

If you still want /dev/shm, instead of commenting out tmpdir, just increase RAM on the server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.