3

I have been spending over 6 hours trying to solve this problem. After installing mysql server, I obviously changed bind-address from 127.0.0.1 to 0.0.0.0. I also tried commenting it out. When I check open port status with Nmap, it shows like below:

Nmap scan report for localhost (127.0.0.1)
Host is up (0.000011s latency).
Not shown: 997 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
23/tcp   open  telnet
3306/tcp open  mysql

so the 3306 port is definitely open. However, when I try to connect the server from my other machine, it shows:

ERROR 2003 (HY000): Can't connect to MySQL server on '49.247.XXX.XXX' (61)

so I check it with telnet and the result is:

telnet: connect to address 49.247.XXX.XXX: Connection refused
telnet: Unable to connect to remote host

so I go back to that server machine an check the status again with netstat and the result is like below:

❯ sudo netstat -tlpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      769/systemd-resolve
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      994/sshd
tcp6       0      0 :::22                   :::*                    LISTEN      994/sshd
tcp6       0      0 :::23                   :::*                    LISTEN      3355/xinetd
tcp6       0      0 :::3306                 :::*                    LISTEN      4108/mysqld

I find the number 3306 so it must be open right? I even tried the "sudo ufw allow XXXX/tcp" command to make sure 3306 is open. However, I ran out of ideas as to what is missing. Does anyone have any idea what to look for or how to fix this? Thanks a lot in advance!

Nick
  • 133
  • 6
  • 1
    Does this answer your question? [How to allow remote connection to mysql](https://stackoverflow.com/questions/14779104/how-to-allow-remote-connection-to-mysql) – Nico Haase Jul 02 '20 at 06:39
  • 1
    I think I would run wireshark to see what is going on. Port being open means just, that TCP handshake passes. It does not need to mean, that you are allowed to connect. – Marek Puchalski Jul 02 '20 at 06:42
  • Still won't work. I have tried this method before – Nick Jul 02 '20 at 06:42
  • Okay will try Wireshark now – Nick Jul 02 '20 at 06:43

1 Answers1

3

You need to also set the firewalld.

Install Firewalld and do the following:

 firewall-cmd --zone=public --add-port=3306/tcp \ --permanent

this will make sure 3306 is open and accepting.

Nicholas An
  • 156
  • 1
  • 9