Support » Installing WordPress » Error establishing a database connection

  • I just started upgrading from 2.05 to 2.2.2. When running everything went fine and I was informed that the database needs an update. After everything was done I’ve recieved the following error message:

    Error establishing a database connection

    This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost. This could mean your host’s database server is down.

    * Are you sure you have the correct username and password?
    * Are you sure that you have typed the correct hostname?
    * Are you sure that the database server is running?

    I haven’t changed username/pw or anything like that. If I create a new DB on the same server and edit the wp-config.php file accordingly everything worls finde. Could it be that my DB was damaged during the upgrade? If yes, how could I restore it?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Could it be that my DB was damaged during the upgrade?

    Um, the only way to answer that is for you to check yourself. Best bet would be to get with your host and see if they offer an interface for the MySQL database. Something like myphpAdmin. Check to see if one of the database tables is corrupted.

    I am getting the same error message.

    I am hosting several sites on my Mac after going through the server videos over at I watched video #9 on how to use MAMP and WordPress. Being my first time I followed it exactly. And I believe that it will work, except for the fact that, like I said earlier, I am hosting multiple sites on the same Mac. In order to figure out how to do that I watched video #6. I believe that if I was hosting only one site it would be working and running WordPress fine.

    Here are some things I have tried to change in order to get this working.
    Within the wp-config.php file I:

    • made both the username/password ‘root’, these are the DB username/password I set up while using MAMP
    • changed ‘localhost’ to ‘’

    Within the httpd.conf file I:

    • made my DocumentRoot point to /Applications/MAMP/htdocs/wordpress
      then I restarted Apache

    I also did these changes:

    • set up my ‘hosts’ file to say this: localhost broadcasthost
      ::1 localhost
    • I changed the Apache port within the MAMP preferences from 8888 to 80
    • my httpd.conf file looks like this:
      <VirtualHost *:80>
      DocumentRoot /Applications/MAMP/htdocs/wordpress

    I believe that is all I did.

    Well I have restarted Apache many times, I have reinstalled WordPress as well as delete my database and start over.

    Any help would be greatly appreciated.

    I like what hair I have left on the top of my head.


    I do habe myphpAdmin. But how can I check if the DB is corrupt or still ok?

    And I get the same error!
    I have installed 4 WordPress blogs previously, earlier versions though that I have upgraded to 2.2.2 without problems.
    So this is my first 2.2.2 installation

    I have the config-file set up correctly, have double-checked that both in my control panel and through phpMyadmin

    Is anyone looking into this?



    My host helped me with this one:
    I was running PHP4 and MySql 4. Upgrading to PHP5 solved the problem immediately.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Error establishing a database connection’ is closed to new replies.