解决端口被占用问题

一、windows系统

   以81端口为例

   1. 在cmd中输入:netstat -aon | findstr 81,得到PID:12968

   2. 然后输入:tasklist | findstr 12968,查看是哪个程序占用了81端口,查询结果是:java.exe

   3. 然后输入:taskkill /f /t /im java.exe,结束进程

  或

  1. 在cmd中输入:netstat -aon | findstr 81,得到PID:12968

  2. 然后输入:taskkill /f /t /PID 12968,结束进程

 二、linux系统

  以3306端口为例

  1. 输入:netstat -tunlp | grep 3306,得到PID:7524

  2. 然后输入:kill -9 7524,结束进程

  或

  1.  输入:ps -ef | grep mysql,得到PID:7524

  2. 然后输入:kill -9 7524,结束进程

原文地址:https://www.cnblogs.com/badbadboyyx/p/11957631.html