CentOS 8 端口
- 查看端口是否开启
[root@fabric-thirteen ~]# firewall-cmd --query-port=3307/tcp
no
no为端口未开启
- 开启3307端口
[root@fabric-thirteen ~]# firewall-cmd --add-port=3307/tcp --permanent
success
success 表示开启成功
- 重启防火墙
[root@fabric-thirteen ~]# firewall-cmd --reload
success
- 查看端口开启列表
[root@fabric-thirteen ~]# firewall-cmd --zone=public --list-ports
3306/tcp 6379/tcp 7779/tcp 3307/tcp
- 查看防火墙状态
[root@fabric-thirteen ~]# firewall-cmd --state
running
- 关闭防火墙
[root@fabric-thirteen ~]# systemctl stop firewalld
- 开启防火墙