WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Error establishing a database connection --- beyond frustrated (10 posts)

  1. ktbird7
    Member
    Posted 1 year ago #

    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.

    <?php
    $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.

  2. amobaroti
    Member
    Posted 1 year ago #

  3. ktbird7
    Member
    Posted 1 year ago #

    No, I've ran the test code there as well and it also says connected successfully.

  4. ktbird7
    Member
    Posted 1 year ago #

    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.

  5. ktbird7
    Member
    Posted 1 year ago #

    Would appreciate any assistance anyone can give on this...

  6. jonradio
    Member
    Posted 1 year ago #

    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: http://wordpress.org/extend/plugins/duplicator/
    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.

  7. ktbird7
    Member
    Posted 1 year ago #

    Here is the URL of the sandbox http://dallasnokill.org/dpa/sandbox/wordpress3/

    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.

  8. ktbird7
    Member
    Posted 1 year ago #

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

    server code: 200
    status: OK
    response:
    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
    {"pass":1,"table_count":0,"table_rows":-2,"query_errs":0}

    :/

  9. jonradio
    Member
    Posted 1 year ago #

    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.

  10. ktbird7
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.