WordPress.org

Ready to get started?Download WordPress

Forums

Can't connect to distant Mysql database from local install (10 posts)

  1. Martin71
    Member
    Posted 3 years ago #

    Hello,

    I need to install a local version of an existing WP blog.
    I want the local install to use my distant Mysql database.
    I am getting an "Error establishing a database connection" error.

    Notes about the situation:
    I am using Windows 7
    I deployed WampServer 2 locally
    I defined virtual hosts, and it works fine with static local sites.
    My local wp-config.php is an exact copy of the distant one (the user/password therefore can't be wrong since the distant site works; likewise the db host name is correct).
    DB_HOST is set to the full DB server host name.
    I can ping it from the Windows 7 machine.

    Could anyone suggest what might be going wrong?

    Thank you.

  2. Pranav Rastogi
    Member
    Posted 3 years ago #

    Hi,

    You'll have to enable remote access to mysql and you'll also have to provide the current mysql user with full access to the database.

    [edit: sig removed as per the forum guidelines]

  3. Martin71
    Member
    Posted 3 years ago #

    Hi Pranav,

    Thanks for your answer.
    I confirmed with my web host that remote access is allowed and it should work.
    Regarding the current mysql user rights, well, accessing the database is working fine from my distant site, so I guess this proves there should not be any issue on that side. (Unless I am missing something of course.)

    Any other suggestion?

    Thanks.

  4. Pranav Rastogi
    Member
    Posted 3 years ago #

    Have you entered the correct mysql host in WordPress config?

  5. Martin71
    Member
    Posted 3 years ago #

    As I said in my initial post above, my local copy of wp-config.php is an exact copy of the one on my distant site, which works fine. Therefore all information is necessarily correct: mysql host, username and password.

  6. Pranav Rastogi
    Member
    Posted 3 years ago #

    Try setting DB_HOST to the server's IP address instead.

  7. Martin71
    Member
    Posted 3 years ago #

    Thanks for the suggestion but it doesn't work either. Same error message.

    Any other suggestion? Might it be linked to Windows 7 and some obscure port or firewall issue?

  8. Pranav Rastogi
    Member
    Posted 3 years ago #

    Yeah, a firewall issue might be possible. Try disabling your firewall.

  9. Martin71
    Member
    Posted 3 years ago #

    I disabled it, but unfortunately it still doesn't work.

  10. Martin71
    Member
    Posted 3 years ago #

    I might add that I have tried this with various WP version including 3.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.