Cách mở port mysql 3306 - Open port 3306
Hướng dẫn cách mở port MySQL cổng 3306 để kết nối từ 1 server khác You need to open TCP port 3306 using iptables or BSD pf firewall. A sample iptables rule to open Linux iptables firewall CODE /sbin/iptables -A INPUT -i eth0 -p tcp --destination-port ...
Hướng dẫn cách mở port MySQL cổng 3306 để kết nối từ 1 server khác
You need to open TCP port 3306 using iptables or BSD pf firewall.
A sample iptables rule to open Linux iptables firewall
OR only allow remote connection from your web server located at 10.5.1.3:
OR only allow remote connection from your lan subnet 192.168.1.0/24:
Finally save all rules (RHEL / CentOS specific command):
# service iptables save
A sample FreeBSD / OpenBSD pf rule ( /etc/pf.conf)
OR allow only access from your web server located at 10.5.1.3:
Test it
From your remote system or your desktop type the following command:
Where,
-u webadmin: webadmin is MySQL username
-h IP or hostname: 65.55.55.2 is MySQL server IP address or hostname (FQDN)
-p : Prompt for password
You can also use the telnet or nc command to connect to port 3306 for testing purpose:
OR
Sample outputs:
Connection to 65.55.55.2 3306 port [tcp/MySQL] succeeded!