Home > Article > Operation and Maintenance > How to open port 3306 in linux
After installing the MYSQL server, all operations on this machine are normal, but when remotely accessing the MYSQL server on other machines, I cannot connect.
## I suspect it is Port problem, result: telnet 192.168.1.245 3306It was found that the connection could not be connected. It turned out that the port was restricted by the firewall.Now just need to Just open port 3306 in the firewall.
Open the firewall configuration file
vi /etc/sysconfig/iptables
As shown:
Add this line:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPTJust add this sentence. Note that this sentence must be added above the last sentence (the addition is open The statement of port 3306 must be before icmp-host-prohibited). Otherwise it will not take effect.
Similarly, if it is another port, just replace "3306" with the corresponding port.
Then restart the firewall
service iptables restartDone!
The above is the detailed content of How to open port 3306 in linux. For more information, please follow other related articles on the PHP Chinese website!