1.查看端口被哪个程序占用 sudo lsof -i tcp:port 示例: sudo lsof -i tcp:8080 查看8080端口是否被占用 2.根据进程PID杀死进程 sudo kill -9 PID 示例: sudo kill -9 3210