2

New guy here please be patient :) I am a windows user with MySQL running on port 3306. I have created inbound and outbound rules for allowing MySQL to listen on port 3306. I have also changed my bind-address in my.ini file to 0.0.0.0 and have commented out skip-networking (restarted mysql too). The user I have created is also allowed to connect from any IP address: 'user'@'%'.

However, when trying to connect remotely from another mac/ windows laptop (Note that the remote connection is from miles away from me (the sever) on a different network), it gives an error: unable to connect to local host. The settings for connecting remotely are:

  • Standard (TCP/IP)
  • Hostname: My private IP address
  • Port: 3306
  • Username: user
  • Password: my password

May I know why? I have also been looking through countless answers but none really helpful.

Please help im at my wits end.

  • Have you tried an IP address of the computer your MySQL server is running on as hostname? – Mihe Sep 25 '22 at 19:23
  • Yes I have, my private IP address is the sever MySQL is running on. It doesn’t connect when I try using my public IP address. – Samuel Chua Sep 25 '22 at 20:04
  • From the connecting host, try "telnet [public-ip-of-mysql-server 3306". Does it connect? If not, you have a networking problem. If it does, you have a mysql configuration problem. – Bret Weinraub Sep 25 '22 at 20:47
  • I just asked because "unable to connect to local host" indicated that you tried to connect to localhost on the remote client. – Mihe Sep 25 '22 at 20:53
  • Yeah I was wondering the same thing @mihe, do you know why it keeps trying to connect to local host despite me changing the host name to my IP address? – Samuel Chua Sep 26 '22 at 05:23
  • @bretweinraub, I’m going to try it in a sec but do you know why it’s trying to connect to local host instead? – Samuel Chua Sep 26 '22 at 05:30
  • @SamuelChua I think you should try and get your networking worked out with telnet, ping, traceroute, netstat [for your routing table]; if that's working the way it should move on to the mysql part. – Bret Weinraub Sep 26 '22 at 17:46
  • @BretWeinraub I have tried to telnet 3306 from a different network and it says failed connection. I have also to port forward from my router to my laptop and then tried telnet 3306. However, this didn't work either. I then tried my public IP and it didnt work too. Hence, this definitely means that it is a networking problem right? How should I solve it then since I have 1. turned off my router firewall, 2. created inbound and outbound rules. – Samuel Chua Sep 27 '22 at 09:02
  • @BretWeinraub I tried telnet localhost and turns out that doesnt work too, I did some searching and I think it may be related to my router.... tho im not sure how to solve that either – Samuel Chua Sep 27 '22 at 09:34
  • @samuelchua well this is progress! Check your listening with either https://docs.rackspace.com/support/how-to/checking-listening-ports-with-netstat/ or https://stackoverflow.com/questions/4421633/who-is-listening-on-a-given-tcp-port-on-mac-os-x and post the results. – Bret Weinraub Sep 28 '22 at 09:56
  • @BretWeinraub I did netstat -a and it shows (TCP 0.0.0.0:3306 LISTENING). – Samuel Chua Sep 29 '22 at 15:11

0 Answers0