0

I trying to run multiple instances of phpmyadmin and MySQL. So I have actually 2 docker-compose.yml files, which contains this

  database:
    container_name: boilerplate_db
    restart: always
    build:
      context: ./docker/database
    environment:
      - MYSQL_DATABASE=${DB_NAME}
      - MYSQL_USER=${DB_USER}
      - MYSQL_PASSWORD=${DB_PWD}
      - MYSQL_ROOT_PASSWORD=${DB_PWD_ROOT}
    volumes:
      - ./docker/database/data.sql:/docker-entrypoint-initdb.d/data.sql

  phpmyadmin:
    container_name: boilerplate_phpmyadmin
    image: phpmyadmin/phpmyadmin
    restart: always
    ports:
      - 8089:80
    environment:
      - PMA_HOST=database
      - MYSQL_USER=${DB_USER}
      - MYSQL_PASSWORD=${DB_PWD}
      - MYSQL_ROOT_PASSWORD=${DB_PWD_ROOT}
    depends_on:
      - database

this is the Dockerfile:

FROM mariadb:latest

CMD ["mysqld"]

EXPOSE 3306

Inside each folder I have different .env variables. In the first folder I've executed: docker-compose up —build -d and everything has worked, I can correctly access to the database using phpmyadmin.

So I did the same to second docker-compose.yml but for some reason I get this error:

(HY000/1045): Access denied

which is weird.

The only different between the two phpmyadmin is the port, the first one run on the port 8088 and the second on 8089. What I did wrong?

NB: This happen only on the second phpmyadmin container which runs over the 8089 port. Seems like a conflict?

3
  • hi and welcome - you can explore your docker container environment with docker ps and apply docker logs to containers to see what has happened. My guess is that you have a conflict in the default Docker network as both DB servers would try to bind to the same port. – Peter Muryshkin Apr 14 at 12:37
  • Hi, so should I use another TCP port for mysql? – sfarzoso Apr 14 at 13:10
  • yes, please try to pass an according variable; alternatively, you can create separate virtual Docker networks and link the containers to them. – Peter Muryshkin Apr 14 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.