无法从主机连接到Docker MySQL

时间:2018-12-25 22:40:10

标签: mysql docker

我使用以下命令启动Docker MySQL:

docker run -p 3306:3306 --name mysql5.7 -e MYSQL_ROOT_PASSWORD=b3RmELKOvCUrAdxIg0GEmugc3SY -d mysql:5.7

但是我无法从主机连接到它:

$ /Applications/MySQLWorkbench.app/Contents/MacOS/mysql -h localhost -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

0 个答案:

没有答案