运行命令
sudo firewall-cmd --get-active-zones
开启端口号为3306
sudo firewall-cmd --zone=public --add-port=3306/tcp --permanent
开启后必须重启防火墙
sudo firewall-cmd --reload
查看端口号是否开启
sudo firewall-cmd --query-port=3306/tcp
关闭端口
sudo firewall-cmd --zone=public remove-port=3306/tcp --permanent