Why can't I telnet to mysql port 3306?
I have configured in
my.cnf and turned off the firewall but it doesn't work. I just created 3 VPS using CentOS 8, seems to have the same problem.
If you're trying to reach mysql over port 3306 from an external location, then yes, you'll need change the bind address in
my.cnf, similar to what's outlined here:
Try to add bind-address = 0.0.0.0 to your [mysqld] section of your my.cnf and restart mysqld.
I just tested this out and it worked successfully. You mentioned you did this, but just to confirm: Add
bind-address = 0.0.0.0, like it mentions, and also comment out
bind-address = 127.0.0.1 by placing the
# in front:
[mysqld] bind-address = 0.0.0.0 # bind-address = 127.0.0.1
Then after restart mysql with
sudo systemctl restart mysql, you should be able to telnet from an external server.
telnet 220.127.116.11 3306 Trying 18.104.22.168... Connected to 192-53-115-99.ip.linodeusercontent.com. Escape character is '^]'. nmap -Pn -p3306 22.214.171.124 Starting Nmap 7.92 ( https://nmap.org ) at 2021-11-26 12:36 EST Nmap scan report for 192-53-115-99.ip.linodeusercontent.com (126.96.36.199) Host is up (0.39s latency). PORT STATE SERVICE 3306/tcp open mysql Nmap done: 1 IP address (1 host up) scanned in 0.51 seconds