connecting to a docker-compose mysql container denies access but docker running same image does not

前端 未结 7 516
情歌与酒
情歌与酒 2020-12-01 05:26

I am having some issues connecting to the mysql docker container that I have launched with docker-compose. This is a long post (sorry!).

Here is my docker-compose.ym

7条回答
  •  感动是毒
    2020-12-01 05:43

    I had the same error "Access denied for user 'admin'@'172.20.0.1' (using password: YES)". And for the long time could not figure out how to resolve it. In my situation docker-compose takes configuration from .env file.

    environment:
      MYSQL_DATABASE: ${DB_DATABASE}
      MYSQL_USER: ${DB_USERNAME}
      MYSQL_PASSWORD: ${DB_PASSWORD}
      MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
    

    Finally I have found issue! The problem was in double quots in parameters.

    DB_PASSWORD="dbpassword"
    

    doesn't work

    DB_PASSWORD=dbpassword
    

    work

提交回复
热议问题