Cowboy Programming Game Development and General Hacking by the Old West

January 27, 2008

Blogroll and Categories not working in WordPress 2.3.2

Filed under: Wordpress — Mick West @ 11:29 am

I had a problem with the “Links” widget not showing up in the sidebar in WordPress, and categories not showing up in admin. I originally thought it was a problem with upgrading to 2.3.2, but eventually tracked it down to what seems like a problem with MySQL (I’m using 4.1.22).

The solution for me was to delete the file /tmp/#sql_5de0_0.MYD (or a file with a similar looking name, and probably zero size)

Note though that vanishing categories and links seems to be a symptom of several problems – including no deactivating (or upgrading) plugins while/after upgrading to 2.3.X. Check this threads for additional details:
http://wordpress.org/support/topic/135564?replies=95

I think my problem was something to do with character sets, given that I have a few blogs (some I just host for other people), and the blogs that worked were in utf8 and the blogs that did not were in latin1, so another solution might be to convert your blog to utf8. This is a much more complex procedure than deleting a spurious temporary file.

To track this down, I first enabled debugging in wp-config.php, by adding the line:

define(‘WP_DEBUG’, true);

Then when you view your blog (turn off caching first), instead of just blankness where the links should be, you will now see an error, and also the query that cause that error. In my case it looked like this:

SELECT t. * , tt. *
FROM wp_terms AS t
INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id
WHERE tt.taxonomy
IN (
'link_category'
)
AND tt.count >0
ORDER BY t.term_id ASC
LIMIT 0 , 30
MySQL said:
#1 - Can't create/write to file '/tmp/#sql_5de0_0.MYD' (Errcode: 17)

I verified that it’s not a problem with WordPress by trying the same query in phpMyAdmin. With my working blogs the query succeeded, and with the non-working blogs it failed, with the same error.

So, I looked in /tmp/ and the file #sql_5de0_0.MYD was there, and of zero length. So, I just deleted it, and everything immediately started working perfectly again.

I suspect that the file was simply left over from when my server crashed under a particularly heavy load a few weeks ago.

This may be related to this problem:

 http://bugs.mysql.com/bug.php?id=11824

This error can also happen on windows installations due to an anti-virus program such as McAfee. You should add the folder where you find the file to MacAfee’s exclusion list.

12 Comments »

  1. Hey Mick,

    Great post, and I came here from the WP forums. I have been reading all of the threads associated with this category issue, but wanted to find the “core” problem before trying any of the work-arounds. I have put in your debug code and found this:

    [Can’t create/write to file ‘#sql_126c_0.MYD’ (Errcode: 17)]
    SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN (‘category’) ORDER BY t.name ASC

    This is on my local development server. Please forgive my ignorance, but can you clue me in as to what may be going on here?

    Thanks a ton for your time.

    Comment by WordPress Modder — February 8, 2008 @ 9:11 am

  2. This is a MySQL error, and not directly related to wordpress.

    MySQL is trying to write a temporary file (#sql_126c_0.MYD in your case). However, for some reason the file already exists, and so it cannot write it.

    The solution is to delete the file. Now I see in your case there is no mention of the /tmp/ directory, so I’m not sure where the file would be. You could just do a search for it.

    While this is a cause, it is not the ROOT cause. Is suspect the root cause is a combination of whatever left the temporary file there, and the code the is unable to deal with it being left there. I suspect the former is due to something crashing without deleting the file, and the latter is really a bug in MySQL. This bug might well be fixed in later versions (I have 4.1.22, and they are up to 4.1.23/24 now).

    Perhaps, if you verify the file is there, you could upgrade MySQL first, to see if that also fixes the problem.

    The problem as stated in the title (Blogroll and Categories not working in WordPress 2.3.2) is a symptom of other problems as well. If someone does not get the error described above, then they are in a different situation, with a different solution.

    Comment by Mick West — February 8, 2008 @ 10:32 am

  3. […] #3: Na toll, die Kategorien werden direkt danach wieder gelöscht. HIIIILFEEEEEE! NACHTRAG #4: Cowboy, ich danke […]

    Pingback by Doppeldeutig » Blogroll und Kategorien weg… — February 9, 2008 @ 2:16 am

  4. okay, I follow the debug step and get the error “WordPress database error: [Can’t create/write to file ‘/tmp/#sql_74b4_0.MYD’ (Errcode: 17)]”

    I am on a shared hosting server. Where do I find that file? Or does my hosting company have to help me? I have looked around using their file manager and not found it.

    thanks

    Richard

    Comment by Richard — February 28, 2008 @ 5:53 pm

  5. I think I needed root access to find and delete the file – I actually ssh’ed in there (as root) to delete it. So probably in your case, yes you would have to get the hosting company to delete it from the shared server.

    Comment by Mick West — February 28, 2008 @ 5:58 pm

  6. I like your blog theme. I want to use it on my blog.
    Can you please tell me from where I can download these theme?

    Many thanks

    ——————————————————————————–
    Dan owner of the future gadgets blog future gadgets and inventions

    Comment by Dan (future gadgets blog) — February 29, 2008 @ 7:51 am

  7. It’s the Tiga theme, there are links to the theme and a patch for latest version of wordpress at the bottom of every page here.

    I added the graphics myself. It’s quite a customizable theme, but seems not directly supported by the original creator.

    Comment by Mick West — February 29, 2008 @ 8:19 am

  8. My categories are just blank white pages and I don’t know why. Can anyone please take a look by clicking one of my categories? Please.

    Comment by Mike — August 13, 2008 @ 7:59 pm

  9. Mike, The categories don’t look white to me?

    Comment by songs — July 30, 2009 @ 5:54 pm

  10. So… I ran into a similar problem. And after searching through and reading a plethora of posts on the matter, got nowhere. Finally, I found this page.

    Turns out, my problem was somewhat related (and this page pointed me in the correct direction). I had TMP variables assigned for my OS (OS/2 Warp Server), but had taken the drive offline that those directories were on. Didnt give it much thought, and the OS itself didn’t complain, because it doesn’t really use the directories – it just tells programs where they are.

    So, after seeing this, I moved those directories to a place that actually existed, and voila! Working blog!!

    Comment by RobertMfromLI — August 16, 2009 @ 12:56 am

  11. […] After searching for a problem like that related to wordpress and mysql on the web I found this link and concluded that even thought this a much older version the problem might still be the same. And […]

    Pingback by Problems with Wordpress categories gone | Mosabuam - Manfred Moser, Werner Moser and gang — September 6, 2009 @ 10:15 pm

  12. “Turns out, my problem was somewhat related (and this page pointed me in the correct direction). I had TMP variables assigned for my OS (OS/2 Warp Server), but had taken the drive offline that those directories were on. Didnt give it much thought, and the OS itself didn’t complain, because it doesn’t really use the directories – it just tells programs where they are.”

    -I also have the same problem as Robert’s. Definitely the same. I dunno how to make it work, and I am also having a problem on widgets. I was trying to work on it based on the information, and nothing happens for me. I do not know what to do. Could someone help us?

    Thank you!!

    Christian Smith
    Webmaster

    Comment by Christian Smith — April 9, 2011 @ 8:00 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

You must be logged in to post a comment.

Powered by WordPress