The Web site of Alex S. Jones, community catalyst, user advocate, Web technologist, barbecue acolyte & information junkie

WordPress Database Error

I’ve been running into problems ever since I upgraded WordPress to 2.x (not sure if it was 2.0 or 2.1) with new posts. The first time a new post was was loaded into the browser, the server kicked out this error:

PHP Warning: mysql_affected_rows() [<a href='function.mysql-affected-rows'>function.mysql-affected-rows</a>]: A link to the server could not be established in /Users/alex/Dev/SilverSpider/site/wp-includes/wp-db.php on line 183

I searched to find an answer when I first ran into the problem, but never found a solution. Then, while I was working on the Ma.gnolia plugin, it cropped up again, so I began comparing my install to the stock set up and and found that my old wp-config.php contained some lines that are not included in the 2.x wp-config-sample.php:

$server = DB_HOST;
$loginsql = DB_USER;
$passsql = DB_PASSWORD;
$base = DB_NAME;

As I upgraded from 1.x, and the instructions say not to mess with the config file, I hadn’t looked into it as a possible source of the problem, but by removing this block of code, all appears to be running properly, at least in my local development environment. This post will either reinforce my theory or blow it to bits…

Show time!

It works!

Well, this post worked perfectly and did not generate an error. If you upgraded from 1.x to 2.x and are running into this problem, backup your wp-config.php and then remove that block of code and try it for yourself. Please let me know if that doesn’t work for you. I’ve filed a ticket so this will be resolved all official-like (3992).

Perhaps Not…

Damn it! The error just re-appeared after I edited this post. Grrr.

  1. Hi,
    I have this problem too. I tried in the WP support forum, but no one was able to help me. Did you find a solution to this? You can check my website and you’ll see the same message at the bottom of the page.
    Bye! =)

    October 10, 2007
  2. I’m afraid I never tracked it down, though it went away after an upgrade of at some point, possibly up to 2.2. It looks like you are running 2.1, so you may want o try upgrading to 2.3 which may fix it for you.

    Good luck in resolving the problem!

    October 10, 2007
  3. I have this problem too actually. I think it only started occurring quite recently - but only in Wordpress Admin (as far as I can tell) Perhaps I should upgrade from 2.1, but I really like UTW so really don’t want to go for 2.3 because the tags system just isn’t sophisticated enough.

    Flick
    October 10, 2007
  4. Flick, have you looked into whether or not you can continue to run UTW within 2.3. They may not be mutually exclusive.

    October 10, 2007
  5. ran into the same problem today. after i post it shows that code. but the post goes up when i go to my site. weird and annoying. i checked the wp forums and no help whatsoever. i even read abietto’s post on the forum. he wasn’t getting any help. i have wp version 2.1 my host only has this on cpanel. im a noob so don’t know how to upgrade on my own.

    October 10, 2007
  6. You may want to install the WordPress Automatic Upgrade plugin which makes it easy to keep your WordPress install up to date. I’ve installed it on one of my sites and found it very easy to use, as it walks you through each step and explains everything along the way. This would allow you to upgrade to 2.3.1, which would hopefully resolve the problems with the database error.

    October 10, 2007

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

Post Information

This entry is categorized under WordPress and tagged , , , .

If you would like to follow the discussion on this post, you can follow the comment feed.