WordPress.org

Ready to get started?Download WordPress

Forums

wp-config.php fails connecting to the database :-( (9 posts)

  1. ocvillas
    Member
    Posted 7 years ago #

    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.
    Thanks!
    Christine

  2. moshu
    Member
    Posted 7 years ago #

    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)

  3. ocvillas
    Member
    Posted 7 years ago #

    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 (http://dbserver.com -- like when I am connecting manually in phpMyAdmin) but it still didn't work. Any ideas?

    Christine

  4. moshu
    Member
    Posted 7 years ago #

    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 :)

  5. Davidlind
    Member
    Posted 7 years ago #

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

  6. JBacchi
    Member
    Posted 7 years ago #

    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.

  7. JBacchi
    Member
    Posted 7 years ago #

    I'm with you Davidlind - I'm giving up. Maybe Movable Type is easier. :)

  8. wec001
    Member
    Posted 7 years ago #

    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 "127.0.0.1".

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

    Good luck!

  9. harknell
    Member
    Posted 7 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic