mac中mysql3306端口被占用

需求:本地mysql端口连到k8s集群中

 

报错:

Unable to listen on port 3306: Listeners failed to create with the following errors: [unable to create listener: Error listen tcp4 127.0.0.1:3306: bind: address already in use unable to create listener: Error listen tcp6 [::1]:3306: bind: address already in use]

error: unable to listen on any of the requested ports: [{3306 3306}]

 

解决问题:

  查下来是mysql本地3306端口被占用,临时解决可以在kubectl命令中换个本地端口,但是一旦项目代码中涉及到已经配置好的端口,就必须彻底解决本地端口被占用的问题

 

MAC:

  在终端敲以下命令:

  

sudo lsof -i tcp:3306  

  输入本地密码

  显示以下代码:

  找到PID对应的数字

COMMAND PID   USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
mysqld  366 _mysql   21u  IPv6 0xdd06f8d9822dae29      0t0  TCP *:mysql (LISTEN)

  接着敲:

sudo kill 336

  可以再次查询3306

  问题解决~

 

posted @ 2022-11-11 15:31  ji哩咕噜  阅读(449)  评论(0)    收藏  举报