端口3306繁忙,但没有使用它的进程 [英] Port 3306 busy but no process using it

查看:150
本文介绍了端口3306繁忙,但没有使用它的进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始玩docker和docker-compose,发现mysql容器有问题。我使用的是官方的mysql:latest图片。当我运行docker-compose up时出现以下错误:

I'm starting to play with docker and docker-compose and I found a problem with the mysql container. I'm using the official mysql:latest image. When I run the docker-compose up i get this error:

启动userland代理时出错:监听tcp 0.0.0.0:3306:绑定:地址已经在使用中

为确保我的docker-compose.yml没问题,我测试了端口3307,一切正常。但是我想使用标准的3306。

To be sure that my docker-compose.yml doesn't have problem, I tested the port 3307 and everything worked fine. But I want to use the standard 3306.

当然我杀死了本地mysql守护程序,但是错误仍然存​​在。所以我运行

Of course I killed my local mysql daemon, but the error persisted. So I run

netstat -lnp | grep 3306

这就是我发现的内容:

Proto Recv-Q Send-Q本地地址外部地址状态PID /程序

tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN-

我还执行了 lsof -i TCP:3306 ,但没有得到任何结果。

I also executed lsof -i TCP:3306 and I didn't get any result.

如何释放3306端口?谢谢!

How can I free the 3306 port? Thanks!

推荐答案

好的,让我们尝试使用Sudo

Okay Lets Try with Sudo

sudo netstat -lpn |grep :3306

您将看到该端口的proceesID,执行

you will see proceesID of that port, Execute with these

kill -9 PID //PID processID used by 3306 Port

在这里-9是为了强行杀死,希望这会有所帮助

In here -9 is for force kill, Hope this Helps

这篇关于端口3306繁忙,但没有使用它的进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆