Home > Operation and Maintenance > CentOS > After installing mysql on centos, port 3306 is blocked

After installing mysql on centos, port 3306 is blocked

王林
Release: 2020-04-03 13:48:32
Original
4070 people have browsed it

After installing mysql on centos, port 3306 is blocked

Problem:

After installing mysql on CentOS 7, localhost can connect to log in to mysql normally, but remote access cannot connect. Tried ping and found that the ping was successful; tried telnet port and found that port 3306 was unreachable.

Solution:

You need to open port 3306 in the firewall configuration.

The command is as follows:

firewall-cmd --zone=public --add-port=3306/tcp --permanent (--permanent永久生效,没有此参数重启后失效)
#重新载入
firewall-cmd --reload
#查看
firewall-cmd --zone=public --query-port=3306/tcp
vi /etc/sysconfig/iptables
#添加
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
Copy after login

Recommended related tutorials: centos tutorial

The above is the detailed content of After installing mysql on centos, port 3306 is blocked. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template