centos7开启防火墙
#永久开启防火墙端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
#查询端口是否开启
firewall-cmd --query-port=80/tcp
#重启防火墙
firewall-cmd --reload
关闭防火墙
systemctl stop firewalld.service
systemctl stop firewalld
取消开启启动防火墙
systemctl disable firewalld.service
#centos 6 开启防火墙
vim /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT