1.防火墙开启3306端口
bash
firewall-cmd --add-port=3306/tcp
2.防火墙生效
bash
firewall-cmd --runtime-to-permanent
3.其他命令(停止和启动防火墙)
bash
systemctl stop firewalld
systemctl start firewalld
4.检查防火墙状态
bash
firewall-cmd --check-config
5.查看防火墙开启端口
bash
firewall-cmd --list-ports
6关闭防火墙端口
bash
firewall-cmd --remove-port=port-number/port-type