docker run mysql 报错:ERROR 2002 (HY000)

时间:2022-11-01 17:56:47

docker run mysql 报错

docker run mysql 报错:ERROR 2002 (HY000)

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1:3306' (111)

处理方式: 查看run命令 docker run -p 3366:3306 -e "MYSQL_ROOT_PASSWORD=Password2018" --name mars-db --restart=always -td mysql:8.0.29

添加 --privileged=true
docker run -p 3366:3306 -e "MYSQL_ROOT_PASSWORD=Password2018" --name mars-db --privileged=true  --restart=always -td mysql:8.0.29