Support » Installing WordPress » wp-config.php fails connecting to the database :-(

  • Hi, Guys!
    I’m trying to install WP and got stuck at Step 5 — creating the database tables.
    wp-config.php fails with the message “Error establishing a database connection”. I am however using the right username and password, and in fact, when I logon manually via phpMyAdmin everything goes fine.
    I’m having the blog & database hosted by my web hosting provider. (Too bad they don’t have a one-step install for WP though.) Can the fact that the webserver is IIS rather than Apache be an issue? They do support php though. I checked the version and it’s php 4.4.0.
    I looked throught the forum for clues but nothing seemed to work.
    Any suggestions would be greatly appreciated.

Viewing 8 replies - 1 through 8 (of 8 total)
  • One-click thing are not always the best.
    Not being a *nix server sometimes can be a problem.
    Which error message did you get? (there are 2)

    Moshu – many thanks for replying. The error I’m getting is “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 …etc”

    I know the username and passwd are correct. I tried replacing ‘localhost’ in the wp-config file with the full database server url ( — like when I am connecting manually in phpMyAdmin) but it still didn’t work. Any ideas?


    Is the user added to the database?
    Has the DB-user all the privileges?
    DB server can NOT be a URL, but could be million things besides “localhost”. What did your host give you?

    and finally, in 99.99% of the cases when a user starts with the sentence: “I know the username and passwd are correct…” – they are not correct 🙂

    Well, then I am just out of luck and too bad.

    I’ve had the same problems that what seems like a 1000 other people have had with the 5 miinute start up. I cannot communicate with the database. I too have tried entering the password from the database admin screen and have no problems – works fine.

    I’ve read and tried the godaddy tutorial from granny, I’ve loaded and unloaded the wordpress folder onto the server twice. I’ve trashed the cache. I’ve started from scratch 4 times. Still no luck. What is sick is, I got this to work for another blog site I installed, once I figured out the hostname had to be included.

    I’m at a loss as what to do next. Any ideas would be appreciated.

    I’m with you Davidlind – I’m giving up. Maybe Movable Type is easier. 🙂

    I encountered this problem as well. After some struggles, it’s now working. Here is what happened in my case and how to solve it. Hopefully it will help you, too.

    1, Log in to mysql as root.
    – Create a database (that I filled the database field in wp-config.php)
    – Grant my user name on the database.
    – It appears to me that the installation will create tables for you but not creating a database. You need to create a database first for future auto table creation.

    ==> this step got me to pass the “Error establishing a database connection”. But a new Error says that now WordPress can find my database with user/passwd but can’t connect to the host.

    2, In wp-config.php, change the default “localhost” to “”.

    After that, the installation steps took about 1 min and finished.

    Good luck!

    One other thing to realize is that many hosted services add an attachment to your database and usernames so that they have your overall username. So if your account on the server is under the overall username “foo” (this is the username you use to log into your user control panel or to FTP) your database and database username might end up as “foo_MyDatabaseName” and “foo_MyUsernameForTheDatabase”. This trips up a lot of people since they think they know their username and password but don’t notice the appended overall username.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘wp-config.php fails connecting to the database :-(’ is closed to new replies.