Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

migrated from Dec 30 '11 at 21:21

This question came from our site for professional and enthusiast programmers.

/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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.