“Can't connect to local MySQL server” in docker-compose

前端 未结 2 1022
庸人自扰
庸人自扰 2021-01-21 20:44

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

2条回答
  •  耶瑟儿~
    2021-01-21 21:01

    You can change DB_HOST localhost to ip in .env. To receive ip mysql docker container need write command:

    docker exec -it  ip add show eth0
    

提交回复
热议问题