Ok, I know this has been asked a lot, but I've tried every advice I can find and I still can't telnet to my Amazon server on port 3306.
-
Add iptables entry for accepting connections on port 3306:
iptables -A INPUT -i eth0 -p tcp -m tcp --dport 3306 -j ACCEPT
-
That doesn't fix it, so I turned off the firewall with
ufw disable
- Add 3306 from anywhere in security group section on Amazon AWS for my specific server. (relevant line: MYSQL TCP 3306 0.0.0.0/0)
- Change bind-address to
0.0.0.0
inmy.cnf
and make sure port is 3306
Still no luck. Is there any other reasons why port 3306 might be blocked? Why can't I connect with telnet? (ofc my aim is to connect with mysql remotely) here is the result of netstat -lnptu
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 16883/mysqld
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 932/sshd
tcp6 0 0 :::80 :::* LISTEN 14030/apache2
tcp6 0 0 :::22 :::* LISTEN 932/sshd
udp 0 0 0.0.0.0:68 0.0.0.0:* 512/dhclient
udp 0 0 0.0.0.0:29313 0.0.0.0:* 512/dhclient
udp6 0 0 :::28486 :::* 512/dhclient
Best Answer
It turns out ufw disable doesn't actually turn iptables rules off. I had this line in my iptables:
and this prevented the appended ACCEPT lines to be ignored. I added the
iptables -I INPUT -i eth0 -p tcp -m tcp --dport 3306 -j ACCEPT
line with -I instead of -A and it worked.final
iptables -L
which worked: