phpmyadmin / docker

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

Struggling to get phpmyadmin working #426

Open EBS-DarkD opened 1 year ago

EBS-DarkD commented 1 year ago

I'm running portainer 2.19.0 and trying to get mariadb and phpmyadmin working together I'v got a stack setup with the following

db1:
    container_name: mariadb
    image: lscr.io/linuxserver/mariadb
    networks:
      t2_proxy:
        ipv4_address: 192.168.92.***
    ports:
      - "3306:3306"
    volumes:
      - /opt/docker/appdata/mariadb/data:/config
    environment:
      TZ: ***
      PUID: 1000
      PGID: 998
      FILE__MYSQL_ROOT_PASSWORD: /run/secrets/mysql_root_password # Note FILE__ (double underscore) - Issue #127
    secrets:
      - mysql_root_password

I can access this via the portainer console and have logged into the mariadb, created some accounts and a database

For the phpmyadmin, i've got the following

  phpmyadmin:
    image: phpmyadmin:latest
    container_name: phpmyadmin
    networks:
      t2_proxy:
        ipv4_address: 192.168.92.***
    ports:
      - "7005:80"
#    links:
#      - db1:db
    environment:
#      - PMA_HOST=192.168.92.***
#      - PMA_PORT=3306
      - PMA_ARBITRARY=1
#      - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/mysql_root_password
    secrets:
      - mysql_root_password
#    volumes:
#      - /opt/docker/appdata/phpmyad:/etc/phpmyadmin

With the config above, when I try access the web interface, I get the error

Warning: require(/etc/phpmyadmin/config.secret.inc.php): Failed to open stream: Permission denied in /etc/phpmyadmin/config.inc.php on line 3

Fatal error: Uncaught Error: Failed opening required '/etc/phpmyadmin/config.secret.inc.php' (include_path='.:/usr/local/lib/php') in /etc/phpmyadmin/config.inc.php:3 Stack trace: #0 /var/www/html/show_config_errors.php(43): include() #1 {main} thrown in /etc/phpmyadmin/config.inc.php on line 3

If I uncomment the volumes portion, the above error goes but then when I try login, I get the following

mysqli::real_connect(): (HY000/2002): No such file or directory

With the pma_arbitary set to '1', I'm expecting it to ask me for a server, but it doesn't get that far, I just get the username and password box If I set either the link or the PMA_HOST, I also get the real_connect error.

I've deleted all the config files, containers and images but I still can't get it to work. Anyone tell me what I've missed here?

williamdes commented 1 year ago

Hi

First you can remove MYSQL_ROOT_PASSWORD_FILE and it's secret config, we do not have any. The volume is not needed.

One simple example is https://github.com/phpmyadmin/docker/blob/272944cc5a10f7740acacbe2a35c2c1f6d9a98c7/testing/docker-compose/docker-compose.testing-one-host.yml#L25

You can use an arbitrary server config like this example: https://github.com/phpmyadmin/docker#usage-with-docker-compose-and-arbitrary-server

Or use PMA_HOST or PMA_HOSTS like in my first example

Where is your database server located? Edit: it's on another docker network So use the container name in PMA_HOST