Forums

[resolved] Error establishing a database connection - odd fix (1 post)

  1. BluegrassBoy
    Member
    Posted 3 years ago #

    I've been attempting a fresh installation of WP 2.6 on Linux (Fedora 6, mysql 5.0.27, php 5.1.6) and kept running into the 'Error establishing a database connection' message. I triple checked the wp-config.php settings, tried changing out 'localhost' for the IP or hostname - no luck.

    Then I tried creating a little dbtest.php script to see if that worked:

    <?
    $db = @mysql_connect('localhost', 'my-user', 'my-password');
    if (!$db) echo "connection failed";
    else echo "connection succeeded";
    ?>

    It did - but not if it was installed under the wordpress directory! I had put my wordpress installation in a directory called 'wordpress' under my server root, so the address of the install script was http://www.my-server.com/wordpress/wp-admin/install.php . I found that http://www.my-server.com/dbtest.php would give me a success message but if I copied the same script into the 'wordpress' directory and tried to access http://www.my-server.com/wordpress/dbtest.php , it gave me the WP "Error establishing a database connection" page.

    Renaming the directory to just about anything other than 'wordpress' allows my dbtest page, and the install.php page, to come up successfully.

    Seeing the large number of posters encountering this error, I thought I would post.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.