Pergunta

I am trying to connect to a remote mysql server but is encountering this error.On the server I have

  1. set bind-address to 0.0.0.0
  2. Changed Iptables to look like this

    target     prot opt source               destination 
    DROP       tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:3306
    ACCEPT     tcp  --  127.0.0.1            0.0.0.0/0            tcp dpt:3306
    ACCEPT     tcp  --  107.22.*.*           0.0.0.0/0            tcp dpt:3306
    

    where 107.22.** is the IP of the machine I am trying to connect from

  3. Restarted UFW

  4. verified that my AWS security groups allow port 3306 is allowed access from everywhere.

What could be the reason for the error?

Foi útil?

Solução

Change iptables to look like this instead:

target     prot opt source               destination 
ACCEPT     tcp  --  127.0.0.1            0.0.0.0/0            tcp dpt:3306
ACCEPT     tcp  --  107.22.*.*           0.0.0.0/0            tcp dpt:3306
DROP       tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:3306

Otherwise, all 3306 traffic gets dropped by the firewall.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top