phpmyadmin / docker

Docker container for phpMyAdmin
https://hub.docker.com/_/phpmyadmin
GNU General Public License v3.0
663 stars 453 forks source link

User not created in phpmyadmin when using docker-compose #392

Open sandwichdreams opened 1 year ago

sandwichdreams commented 1 year ago

When I run docker-compose up the container starts and I can log in with root, but no user named phpmyadmin is created. Is there something missing in the yml file?

version: "3.0"

networks:
    dev:

services:
  mariadb:
    image: mariadb:latest
    restart: always
    ports:
      - 3306:3306
    environment:
      - MYSQL_ROOT_PASSWORD=root
      - MYSQL_DATABASE=example
      - MYSQL_USER=mariadb
      - MYSQL_PASSWORD=mariadb
    volumes:
      - /docker/mariadb:/var/lib/mysql
      - /etc/localtime:/etc/localtime:ro
    networks:
      - dev

  phpmyadmin:
    image: phpmyadmin:latest
    depends_on:
      - mariadb
    restart: always
    ports:
      - "8080:80"
    environment:
      - MYSQL_ROOT_PASSWORD=root
      - MYSQL_USER=phpmyadmin
      - MYSQL_PASSWORD=phpmyadmin
      - PMA_HOST=mariadb
    volumes:
      - /etc/localtime:/etc/localtime:ro
    networks:
      - dev
williamdes commented 1 year ago

Hi I think youare mistaken, the only user that will be created is by MariaDB container: mariadb

See https://github.com/phpmyadmin/docker/blob/master/testing/docker-compose/docker-compose.testing-one-host.yml as another example

sandwichdreams commented 1 year ago

When I read the documentation, I understand it like this:

If I have the MYSQL_ROOT_PASSWORD variable, phpMyAdmin logs in and creates the user that I entered via MYSQL_USER with the password MYSQL_PASSWORD

If this is not correct. Is there any other variable to implement so I automatically create a user in the phpMyAdmin container?

williamdes commented 1 year ago

If this is not correct. Is there any other variable to implement so I automatically create a user in the phpMyAdmin container?

Actually there is no such feature, I am not sure we should add it. And this variable does not exist, see: https://github.com/phpmyadmin/docker#environment-variables-summary

Where did you see such a configuration?

ibennetch commented 1 year ago

You may intend for those variables to be part of your MariaDB container instead.

rk9qn3j commented 1 year ago

Where did you see such a configuration?

https://github.com/phpmyadmin/docker#credentials

When reading those lines, I get the impression that the phpmyadmin container uses the root credentials to log in and create a new user with a specific username and password.

williamdes commented 1 year ago

Where did you see such a configuration?

https://github.com/phpmyadmin/docker#credentials

When reading those lines, I get the impression that the phpmyadmin container uses the root credentials to log in and create a new user with a specific username and password.

Okay, maybe we need to clarify that. The two ENVs are not for our container