“Can't connect to local MySQL server” in docker-compose
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have Laravel application with MySQL and I'm trying to run it in Docker using docker-compose. But when app trying to connect DB, it throws: PDOException in Connector.php line 55: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) My docker-compose.yml: load_balancer: image: tutum/haproxy links: - web ports: - "80:80" cache: image: redis db: image: mysql environment: MYSQL_ROOT_PASSWORD: Q1w2e3r4t5 MYSQL_DATABASE: regappbase web: image: andrewmclagan/nginx-hhvm links: - db - cache