CentOS 7.0默认使用的是firewall作为防火墙,要想使用iptables必须重新设置一下。
1.关闭防火墙
[root@localhost ~]# systemctl stop firewalld.service2.禁止防火墙开机自启
[root@localhost ~]# systemctl disable firewalld.service3.安装iptables service
yum -y install iptables-services4.修改防火墙配置,如增加防火墙端口3306
vi /etc/sysconfig/iptables 增加以下规则
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT保存退出后
重启防火墙使配置生效
[root@localhost ~]# systemctl restart iptables.service设置防火墙开机启动
[root@localhost ~]# systemctl enable iptables.service重启系统使设置生效
[root@localhost ~]# reboot注意:mysql安装后,如果不关掉防火墙,则远程不能连接成功。