Support » Installing WordPress » Error establishing a database connection — beyond frustrated

  • Resolved ktbird7


    Extremely frustrated, please help :/

    I went to set up a new sandbox of my existing WordPress site. Everything there works 100%.

    I copied over all files, created a new database, copied over the database. I changed the wp-config.php to match the new database values. I searched for every instance of the old url in the database and changed them all to the new one.

    I *know* they are correct because I ran this code with the username/password copy pasted directly over and it worked.

    $db = @mysql_connect('localhost', 'un', 'pw');
    if (!$db) echo "connection failed";
    else echo "connection succeeded";

    My front page loads fine. My wp-admin loads fine. However, every single page shows the “Error establishing a database connection” error.

    I have tried emptying the cache, changing file permissions, repairing every table in the database, running the repair script.

    Please help. Thank you.

Viewing 9 replies - 1 through 9 (of 9 total)
  • No, I’ve ran the test code there as well and it also says connected successfully.

    I don’t understand why the home page works (which means that the configuration must be correct, or else it would also be broken) yet every single page has this error.

    Would appreciate any assistance anyone can give on this…

    A wild guess says that one or both of the URLs in General-Settings is wrong.

    FYI, I no longer do clones manually after discovering this plugin:
    You may want to give it a try.

    I’m not clear on your “sandbox”, in terms of it being accessible from the Internet. If so, posting the URL will really help people try and determine what is wrong.

    Here is the URL of the sandbox

    I have checked both of the URLs in general settings.

    I will try the plugin you’ve linked and see if I get better results with that.

    Not having much luck with the plugin, keeps failing with this error:

    server code: 200
    status: OK
    Warning: file_get_contents(installer-data.sql) [function.file-get-contents]: failed to open stream: No such file or directory in /home/dallasn3/public_html/dpa/sandbox/wordpress4/installer.php on line 614


    I’m stumped, too. I just looked at your sandbox site and even tried the alternate URL approach of ?page_id= and got the same thing.

    But, I would try Saving Permalinks anyway. Don’t change them, just push the Save button.

    I’ve never heard of Permalinks causing your error, but you made no mention of doing the Save, and it is a required part of moving/cloning a site.

    jonradio, your advice seems to have helped. Thanks for the assistance. I will mark this as resolved for now.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Error establishing a database connection — beyond frustrated’ is closed to new replies.