Forums

[resolved] Error establishing a database connection (12 posts)

  1. linuxlover992000
    Member
    Posted 5 years ago #

    I am complete newbie to wordpress, MySQL and phpMyAdmin.

    However, I managed to successfully install )on my home Linux server, Fedora Core 4) MySQL and phpMyAdmin - and even create a database name 'wordpress' using phpMyAdmin as outlined here:

    http://codex.wordpress.org/Installing_WordPress#Using_phpMyAdmin

    I basically followed the detailed installation instructions as outlined here:

    http://codex.wordpress.org/Installing_WordPress#Detailed_Instructions

    I followed steps 1, 2, 3 and 4 without any problem.

    However, when I attempted to perform step 5 (run the install script), I was immediately met with an error page 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. 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?

    Now... Yes, I am sure that the database server is running. I am sure that I have the correct username and password (as far as I could tell - are there any logs that can help see what is being sent?). And as far as the hostname goes I think I did it right (localhost).

    So... How do I start troubleshooting a problem like this?

    I am running MySQL 4.1.14, phpMyAdmin - 2.8.0.4 on Fedora Core 4 - trying to make WordPress 2.0.2 work.

    Any tip or help would be greatly appreciated.

    Thanks!
    Lynn

  2. linuxlover992000
    Member
    Posted 5 years ago #

    Hmmm... suspecting a username/password mismtach, I modified wp-config.php to to contain 'root' and the root's password in DB_USER and DB_PASSWORD, respectively.

    And... it worked!

    Which brings the obvious question: How come WordPress instructs me to use any username and password (I used 'wordpress' and 'wordpresspassword' respectively), phpMyAdmin displays that username details as valid, but step 5 fails for that username?

    Even more importantly: Now that the WordPress installation seems to have succeeded (using the 'root' username and password), what are the implications on the ability to maintain this database remotely?

    Thanks!

  3. linuxlover992000
    Member
    Posted 5 years ago #

    Well, I tried once again step 2 as outline here:

    http://codex.wordpress.org/Installing_WordPress#Using_phpMyAdmin

    This time adding a *different* username and password and the problem is consistent: running the wp-admin/install.php works only for 'root'.

    Which tells me that something in the instructions is simply missing.

    Uh oh...

    Now what do I do?

    I can go ahead and continue configuring with 'root' but:

    (1) I am almost sure this will create some problems down the road.

    (2) Store the root password in *clear text* in wp-config.php??? No thanks.

    Any help?

    Thanks,
    Lynn

  4. Chris_K
    Member
    Posted 5 years ago #

    When you create your non-root account, are you positive you're following step 3 on the linked page?

    Return to the Privileges screen and click the Check privileges icon on the user you've just created for WordPress. In the Database-specific privileges section, select the database you've just created for WordPress under the Add privileges to the following database dropdown. The page will refresh with privileges for that database. Click Check All to select all privileges, and click Go.

    It sounds like the new user doesn't have access to the DB.

  5. linuxlover992000
    Member
    Posted 5 years ago #

    Yes, I am positive that I am following step 3 but it is quite possible that ironically this is might be the problem, since in step 2.5 it says:

    "Leave all options under Global privileges at their defaults."

    Now, the *global* privileges are all unchecked for that user. Could this be the problem?

    BTW, is there a way to attach to this post a snapshot of the browser so that I can show exactly what I am doing?

    Thanks,
    Lynn

  6. Chris_K
    Member
    Posted 5 years ago #

    Quick and dirty (and free) picture posting: http://allyoucanupload.webshots.com/ Upload your screenshot and toss a link here?

  7. Chris_K
    Member
    Posted 5 years ago #

    Also, try this article as well (step 2) http://codex.wordpress.org/Installing_WordPress#Detailed_Instructions

    [edit: err, nevermind, it seems to link back to where you are already]

  8. linuxlover992000
    Member
    Posted 5 years ago #

    OK - I uploaded the snapshots so that everyone can see what I did and tell me what I am doing wrong:

    1. First, I start with basically an empty list of MySQL users: http://aycu05.webshots.com/image/2044/1480322176952002330_rs.jpg
    and click 'Add a new User'

    2. That leads me to the following page in which I only fill the username and password. I can promise that these are the same as in the wp-config.php file.

    http://allyoucanupload.webshots.com/viewimage?imageID=1695920215476749610

    Notice that by default all global privileges are unchecked - and I leave them that way based on what the instructions say.

    In the "Database-specific section I select 'wordpress' - which leads to the following page:

    3. I get the following page:

    http://aycu10.webshots.com/image/849/1765916026465156197_rs.jpg

    which I use to check all database-specific privileges.

    I click 'Go' and get the following page:

    4. Page which confirms the update of the privileges:

    http://aycu23.webshots.com/image/462/1928039558288059854_rs.jpg

    5. Now clicking on the Privileges tab again, shows the updates list of users:

    http://aycu14.webshots.com/image/773/1710760894648363178_rs.jpg

    It seems that I did eveything according to the instructions. So what am I doing wrong?

    Thanks,
    Lynn

  9. Chris_K
    Member
    Posted 5 years ago #

    When creating the user, try specifing server for it as "localhost" instead of "%" and see if that changes anything?

  10. linuxlover992000
    Member
    Posted 5 years ago #

    Bingo! That was it. I replaced the "%" in the server field by "localhost" and it solved all problems. (I didn't have to created another user, I just edited that part for the user 'wordpress' I already created.

    Thank you so much, HandySolo!

    Now I am trying to think whether the detailed instructions can be improved further.

  11. coopcdebaca
    Member
    Posted 5 years ago #

    I am having the same error message that says:

    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 did not use the detailed instructions though. I added the database through my control panel (Cox web hosting - I don't recommend them) and assigned my database name, username, and password. I then changed the wp-config file with this info and then uploaded the wordpress files into my site folder. When I try to open the "/wp-admin/install.php" file in my browser, that message comes up.

  12. linuxlover992000
    Member
    Posted 5 years ago #

    coopcdebaca, my very fresh & limited experience with wordpress suggests that the error message is very informative and contains all the hints to solving the problem.

    In my case it was bullet #2 (hostname).

    I guess that you have already checked that otherwise you wouldn't have posted here.

    So, I would suggest that you go for bullets #3 and #1 (in that order).

    Other than that I am really clueless.

Topic Closed

This topic has been closed to new replies.

About this Topic