If you find yourself unable to connect to port 3306, it could be blocked by your ISP, local firewall, router, modem, or other network configurations.
Verifying the Issue
To diagnose this, try connecting to an external MySQL server, like db4free.net:
telnet db4free.net 3306
If you're unable to establish a connection, it's likely that the issue resides on your side.
A Potential Solution: Setting Up a Tunnel
Should you face this issue, one workaround is to create a tunnel using a different port. While there are various methods to achieve this, here's how I did it on a Linux server using Nginx:
First, ensure the ngx_stream_module.so is installed. Then, add the following to nginx.conf:
stream {
server {
listen [Your_Chosen_Port]; # Example: 50000
proxy_pass [Your_RDS_Endpoint_or_MySQL_Server]:3306;
}
}
Using this approach, you can bypass the blockage on port 3306 and connect through another port of your choosing. Also, confirm that the new port you've chosen is configured to allow incoming connections in your Security Group settings.
Important: Whenever you open a new port, ensure that it's properly secured to prevent unauthorized access.