Home  >  Article  >  Operation and Maintenance  >  How to open port 3306 in linux

How to open port 3306 in linux

(*-*)浩
(*-*)浩Original
2019-05-30 14:43:4311759browse

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.

How to open port 3306 in linux

## I suspect it is Port problem, result:

telnet 192.168.1.245 3306

It 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:

How to open port 3306 in linux

Add this line:

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
Just 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 restart
Done!

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn