The MU forums have moved to WordPress.org

Error establishing a database connection (20 posts)

  1. Homerboy
    Member
    Posted 17 years ago #

    I've seen this error posted a few times, but never a clear resolution.

    I am running my own server at home (IIS, port 8080, mySQL, PHP5)I've had this config set up before and working fine with Wordpress but I recently formatted my server and started over for various reasons. Now it seems I can not get wordpress to connect to my mySQL server.

    mySQL is up and running. This I know. I can connect to it via a GUI interface using the wordpress log and get to the wordpress database without problem.

    When I try to load the wordpress pages though I get the following error:

    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?

    If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.

    YES I am using the proper login and pass. I have even tried the root login and pass to no avail. I have tried "localhost", I have tried the internal IP (192.168.1.XXX) and I have tried the external IP, and even the domain name for my server. Nothing works.

    Help please!!!!

  2. drmike
    Member
    Posted 17 years ago #

    WPMu isn't going to work on port 8080. Just for reference. It's hard coded for port 80.

    May want to try using localhost.localdomain instead. I know that has come up for a solution in the past.

    Anyhting in the error logs for mysql?

    I really which a real error would kick out with mysql errors. *sigh*

  3. pandamatak
    Member
    Posted 17 years ago #

    Although this topic has been discussed ad-nauseum on various forums, I can't seem to find a satisfactory solution! Any help would be appreciated.

    I can assure you that I have the right username and password in mysql! For example:

    mysql> select * from user_privileges
    ...
    | 'wordpress'@'localhost' | NULL | USAGE | NO |
    ...

    {localhost}: mysql -h localhost -u wordpress -p wordpress
    Enter password:
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 32 to server version: 5.0.27

    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

    mysql>

    See - I can manually connect to the database with the right password.

    And I also have the same password in wp-config.php:

    define('DB_NAME', 'wordpress');
    define('DB_USER', 'wordpress');
    define('DB_PASSWORD', my password);
    define('DB_HOST', 'localhost');

    And yet, when I run wp-admin/install.php, I get the above error!

    Thanks for any light any of you can shed on this.

    &

  4. drmike
    Member
    Posted 17 years ago #

    Check with your host. Depending on the software running the box, it may be adding something like your username to teh name of the mysql-user or mysql-database. Since you're at a command prompt as the user, you may not need it there so it works then but not when the webserver is handling the connection.

    Also make sure that the mysql-user has access to the database as I know CPanel requires that.

  5. zenon
    Member
    Posted 17 years ago #

    I was just confronted with this same problem on one machine, although an *identical* installation on another *identical* machine worked just fine. I was able to work around the problem by changing ('DB_HOST', 'localhost') to ('DB_HOST', '127.0.0.1'). Very weird, especially since /etc/hosts says "127.0.0.1 localhost.localdomain localhost".

    FWIW, ipv6 is enabled on the machine that's misbehaving but not on the one that works as it should. On the problem machine, mysql only binds on v4 addresses and does not listen on v6. I have no idea if this is relevant, it just happens to be the only difference between the two machines.

  6. lunabyte
    Member
    Posted 17 years ago #

    It may seem kinda trivial, but it may have needed:

    127.0.0.1 localhost
    127.0.0.1 localhost.localdomain

    If the only difference is literally the option for v6, then that would likely be the place to start looking if the modification to /etc/hosts above didn't correct it.

    For me, if there isn't a reason for v6, I turn it off.

  7. drmiketemp
    Member
    Posted 17 years ago #

    Stupid aside since it just popped into my head. I wonder what will happen when we get to v8? :)

  8. lunabyte
    Member
    Posted 17 years ago #

    If past history is any indication, like with v6, nothing. lol

  9. iomatic
    Member
    Posted 15 years ago #

    I was trying to develop on a local machine (Mac OS X 10.5), and changing the localhost variable to 127.0.0.1 fixed this. This needs to be documented better?

    I wonder if it's because of having virtual hosts enabled?

  10. visyel
    Member
    Posted 15 years ago #

    Hi, I also have this problem...

    After I get this message:

    Installation Finished!

    Congratulations!
    Your WordPress µ site has been configured.

    You can log in using the username "admin" and password 7531caa1ca0d

    Directory Permissions

    Please remember to reset the permissions on the following directories:

  11. /home/a5071943/public_html
  12. /home/a5071943/public_html/wp-content/
  13. You can probably use the following command to fix the permissions but check with your host if it doubt:
    chmod 755 /home/a5071943/public_html /home/a5071943/public_html/wp-content/

    Further reading

    If you run into problems, please search the WordPress µ Forums where you will most likely find a solution. Please don't post there before searching. It's not polite.
    There is also the WordPress µ Trac. That's our bug tracker.
    Thanks for installing WordPress µ!

    Donncha
    wpmu version: 2.7

    I immediately reset the permissions in the directories mentioned above to 755, and when I clicked the "Log In" button at the Installation page, it shows "Error establishing database connection"

    This is my third attempt in installing the Wordpress MU, and this always happens even if I already reset the permissions. What is wrong with this and what can I do about it? Thank you.

  14. VentureMaker
    Member
    Posted 15 years ago #

    Who's the owner of wp-config.php file?

  15. visyel
    Member
    Posted 15 years ago #

    What do you mean, who's the owner?

  16. VentureMaker
    Member
    Posted 15 years ago #

  17. visyel
    Member
    Posted 15 years ago #

    Okay, I understand it now, so what chmod setting should I set my wp-config.php file?

  18. VentureMaker
    Member
    Posted 15 years ago #

    So, who's the owner of wp-config.php file now? :)

  19. visyel
    Member
    Posted 15 years ago #

    My wp-config.php file's permissions is rw-r--r--

  20. tdjcbe
    Member
    Posted 15 years ago #

    That's permissions. Need the owner please. Should be something like apache.apache or username.username.

  21. SteveAtty
    Member
    Posted 15 years ago #

    but its world readable so there shouldn't be any problems with that.

  22. visyel
    Member
    Posted 15 years ago #

    @tdjcbe, where can I find that?

    @SteveAtty, I just don't know what's the problem, it's still on Database Error.

  23. andrea_r
    Moderator
    Posted 15 years ago #

    Then it means the db credentials were incorrect when you typed them in.

    Delete wp-config.php, delete .htaccess and try again.

About this Topic

  • Started 17 years ago by Homerboy
  • Latest reply from andrea_r