端口检查

  • linux
1
telnet 192.168.1.102 3306
  • mac
1
nc -vz -w 2 192.168.1.104 3306

查看端口占用

  • Centos7+
1
2
3
4
5
6
7
8
9
10
11
lsof -i tcp:80  # 查看80端口占用情况

netstat -ntlp # 列出所有端口

firewall-cmd --query-port=3306/tcp # 查询是否开启3306端口

firewall-cmd --zone=public --add-port=3306/tcp --permanent # 开启端口

firewall-cmd --zone=public --remove-port=3306/tcp --permanent # 关闭端口

firewall-cmd --reload #重启防火墙

杀掉进程

  • Centos
1
2
3
netstat -tpnul # 查看当前所有正在运行的进程
ps aux |grep httpd # 查看 httpd 进程
kill -9 6732 # 6732为httpd进程对应的进程ID

评论