解决mac系统docker启动mysql端口被占用
错误提示
Error response from daemon: Cannot restart container cfcf: driver failed programming external connectivity on endpoint my_mysql (da2dd9dd850f0b8eced268a0f92cfcdcc7fe2b172098a7b46ea7f6dfcfd314bb): Error starting userland proxy: Bind for 0.0.0.0:3306 failed: port is already allocated
先尝试使用正常流程操作
sudo lsof -i tcp:3306
kill pid
会发现kill掉的服务,会换个pid又重启了,mysqld杀不死
这个是因为LaunchDeamons定时任务守护mysqld进程
解决方法:
1、命令关闭
sudo launchctl unload -w /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
2、还可以直接简单粗暴在mysql的可视化客户端手动关闭的
再去重启启动失败的docker
docker restart CONTAINER ID
作者信息
Sean
Stay hungry,Stay foolish.