windows cmd快速查看端口占用情况

windows cmd快速查看端口占用情况

1968发表于2016-10-22

在调试服务或者程序的时候我们经常会通过检测对应端口是否打开来判断服务是否成功启动,本例就拿mysql的3306来实验。


再看看3306端口是否已经被占用

一、查看端口占用

netstat -aon|findstr "3306"

二、查看id对应的程序

tasklist|findstr "6572"
==============================
C:\Users\Administrator>netstat -aon|findstr "3306"
TCP 0.0.0.0:3306 0.0.0.0:0 LISTENING 1948
TCP 192.168.1.129:53333 192.168.0.200:3306 ESTABLISHED 7480
TCP 192.168.26.1:54305 192.168.26.129:3306 ESTABLISHED 6572
TCP 192.168.26.1:54306 192.168.26.128:3306 ESTABLISHED 6572
TCP 192.168.26.1:54340 192.168.26.128:3306 ESTABLISHED 6572
TCP 192.168.26.1:54341 192.168.26.129:3306 ESTABLISHED 6572
TCP 192.168.26.1:54342 192.168.26.128:3306 ESTABLISHED 6572
TCP 192.168.26.1:54343 192.168.26.128:3306 ESTABLISHED 6572
TCP 192.168.26.1:54344 192.168.26.129:3306 ESTABLISHED 6572
TCP 192.168.26.1:54345 192.168.26.129:3306 ESTABLISHED 6572
TCP 192.168.26.1:54468 192.168.26.128:3306 ESTABLISHED 6572
TCP 192.168.26.1:54469 192.168.26.128:3306 ESTABLISHED 6572
TCP 192.168.26.1:54470 192.168.26.129:3306 ESTABLISHED 6572
TCP 192.168.26.1:54471 192.168.26.129:3306 ESTABLISHED 6572
TCP 192.168.26.1:54791 192.168.26.129:3306 ESTABLISHED 6572
TCP 192.168.26.1:54792 192.168.26.128:3306 ESTABLISHED 6572
TCP 192.168.26.1:54859 192.168.26.129:3306 ESTABLISHED 6572
TCP 192.168.26.1:54860 192.168.26.128:3306 ESTABLISHED 6572

C:\Users\Administrator>tasklist|findstr "6572"

java.exe 6572 Console 1 300,288 K


小编蓝狐