Docker Community Forums

Share and learn in the Docker community.

Phpmyadmin: Connection refused

I am currently setting up mysql and phpmyadmin with docker. Via IP: 8083 I also get to the phpmyadmin interface. Only my access via username: user / password: test does not work. I just can’t find the mistake. Link parameter is also set.

mysqli::real_connect(): (HY000/2002): Connection refused

docker-compose.yaml:

Connection refused"

docker-compose.yaml
  db:
    restart: always
    container_name: mydb
    image: mysql:5.7

    volumes:
      - "/home/user/db:/var/lib/mysql"

    command: --default-authentication-plugin=mysql_native_password

    environment:
      MYSQL_ROOT_PASSWORD: test
      MYSQL_DATABASE: mydb
      MYSQL_USER: user
      MYSQL_PASSWORD: test
      MYSQL_TCP_PORT: 3307

    ports:
      - "3307:3306"

  # phpmyadmin
  phpmyadmin:
    links:
      - db:db
    image: phpmyadmin/phpmyadmin
    restart: always
    ports:
      - '8083:80'
    environment:
      MYSQL_USER: user
      MYSQL_PASSWORD: test
      MYSQL_ROOT_PASSWORD: test

Change your MYSQL_TCP_PORT to 3306 under the environment section

Yep, thats it. Also i had to wait like 30 seconds to login, otherweise user/test was not working. Thanks.