Support » Installing WordPress » Problem establishing a database connection after move

  • I just moved hosts and I’m trying to get my WP blog up and running again. I changed the info in the wp_config.php file so it had my new database username and password, etc. But now it’s saying:

    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.

    I already got another one of my sites that uses an SQL db up and running, so I don’t think it’s a problem with my host, but I’m 100% sure that the username and password is correct. I even added a second user to the db to see if a different username would work, but I got the same message.

    I don’t know what to try now.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Ok then.

    Would I be able to get my blog back if I started from scratch? If I installed WP again from scratch and got it working, could I then just reupload my current blog files to the new WP folder and import the DB info in phpmyadmin and have it be my blog again?

    Did you check with your host to make sure you’re setting it up correctly?

    And yes, you can try redoing the whole maneuver. If you subsequently get the same error, then you need to talk to your host.

    Thank you for responding.

    My husband managed to figure out the problem. We had to use the address of the host name and the port number instead of just using “localhost”. I had tried using the host name before, but it only worked when coupled with the port number (separated by a colon).

    Oh ok, can this be changed to [Resolved] now, or..?




    actually, i’m having the same exact problem (changed hosts for two blogs; one switch worked, one didn’t. getting the same error).

    i’ve gone through the backed-up database and tried doing a ‘find and replace’ for the absolute path (it’s different on the new host), thinking that could be it…but still, same problem.

    allie, could you explain in slightly more detail what you had to modify?

    thanks for any insight.




    I just had to provide a more specific host name as I did my first installation of WordPress.

    “localhost” alone wasn’t sufficient, I had to use


    I supposed we’re falling into that 1% of the people for whom host “localhost” needs to be changed. 🙂

    Samuel B


    Check with your host. Some use an ip address – some use something like: or 3306

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Problem establishing a database connection after move’ is closed to new replies.