Trying to connect to remote MySQL host (error 2003)

前端 未结 5 1061
南旧
南旧 2020-12-01 15:44

I have a MySQL instance running on a Debian server and I can connect to it locally with no problems. However, I am unable to connect to it remotely. When I try this from m

相关标签:
5条回答
  • 2020-12-01 16:26

    for me this was to enable the port 3306 in /etc/default/iptables file to allow the incoming traffic from any host by uncommenting the below given line:

    #-A INPUT -p tcp --dport 3306 -j ACCEPT
    
    0 讨论(0)
  • 2020-12-01 16:29

    If you use VPN connection to connect remote database server and you got this kind of error then just check it out two simple steps...

    1) In windows machine, please go to "Control Panel\Network and Internet\Network Connections" path and right click on local area network and go to properties. Click on TCP/IPv4 and go the properties. Make sure the IP and DNS server(if you use DHCP or not?).

    2) After this please restart the Machine and check it out again.

    Hope this will work. In my case it works.

    Note: Please make sure all your settings are correct. This answer is funny but it works in my case :)

    Thanks!

    0 讨论(0)
  • 2020-12-01 16:34

    This may due to 3306 port is closed , check your server port status

    http://www.yougetsignal.com/tools/open-ports/

    If it shows closed, that means you can't access it from out side the machine , to open the port

    ufw - Uncomplicated Firewall

    The default firewall configuration tool for Ubuntu is ufw. The following are some examples of how to use ufw:

    First, ufw needs to be enabled. From a terminal prompt enter:

    sudo ufw enable
    

    To open a port (mysql):

    sudo ufw allow 3306
    

    To see the firewall status, enter:

    sudo ufw status
    
    0 讨论(0)
  • 2020-12-01 16:36

    You should check your MySQL Server configuration to see if it bind to 127.0.0.1, then you can only connect to mysql if your app is on same server. There's an easy way, to have webamin installed and you can control via web interface.

    0 讨论(0)
  • 2020-12-01 16:40

    Based on your response, you need to find if there is a device between you and the server that blocks your connection. You should also ensure that you can telnet to 3306 on that server's ethernet address when logged into the server... if not, you probably have not got the service bound to the ethernet in my.cnf... see the bind-address parameter.

    0 讨论(0)
提交回复
热议问题