phpmyadmin / docker

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

phpMyAdmin not working on browser with warden docker #404

Closed RakeshJesadiya closed 1 year ago

RakeshJesadiya commented 1 year ago

Describe the bug

I am running warden to local development of my Magento projects. I am using PHPMyAdmin to check database-related stuff. I am using Warden https://github.com/wardenenv/warden from the link.

I have just upgraded Warden in my Linux Ubuntu 20.04 and after that, I am not able to access phpmyadmin from the browser but able to access it from the Command line tools (CLI).

I get an error, MySQL said: Documentation Cannot connect: invalid settings.

To Reproduce

I have added the Phpmyadmin configuration via the warden-env.yml file.

version: "3.5"
services:
  php-fpm:
    ports:
      - "4000:4000"
      - "3001:3001"
  phpmyadmin:
    restart: always
    image: docker.io/library/phpmyadmin:latest
    hostname: ${WARDEN_ENV_NAME}-phpmyadmin
    domainname: phpmyadmin.${WARDEN_ENV_NAME}.test
    ports:
      - 9200:80
    environment:
      - PMA_HOSTS=${WARDEN_ENV_NAME}_db_1
      - PMA_USER=magento
      - PMA_PASSWORD=magento
      - PMA_ABSOLUTE_URI=http://phpmyadmin.${TRAEFIK_DOMAIN}

Expected behavior

If I go with CLI tools, I am able to access database with CLI.

When you hit the URL from the browser it will show phpmyadmin GUI, http://0.0.0.0:9200/index.php

Earlier it was working fine but suddenly it stopped working.

Screenshots

phpmyadmin

williamdes commented 1 year ago

Hi @RakeshJesadiya Your issue seems to be out of the scope of phpMyAdmin since there is no bug. That said your connectivity problem is maybe caused because your database is in another Docker network or not started. Can you check ${WARDEN_ENV_NAME}_db_1 is in the same network or has access to phpMyAdmin and vice-versa ?

Otherwise try:

https://hub.docker.com/_/phpmyadmin

phpmyadmin:
    restart: always
    image: docker.io/library/phpmyadmin:latest
     # Not sure it really has an importance
-   hostname: ${WARDEN_ENV_NAME}-phpmyadmin
     # Not sure it really has an importance
-   domainname: phpmyadmin.${WARDEN_ENV_NAME}.test
-   ports:
-      - 9200:80
+   network_mode: host
    environment:
      - PMA_HOSTS=${WARDEN_ENV_NAME}_db_1
      - PMA_USER=magento
      - PMA_PASSWORD=magento
      - PMA_ABSOLUTE_URI=http://phpmyadmin.${TRAEFIK_DOMAIN}
+     - APACHE_PORT=9200
RakeshJesadiya commented 1 year ago

@williamdes Thanks for pointing out. Its an issue of image declaration.

My Hostname contains - instead of _

PMA_HOSTS=${WARDEN_ENV_NAME}_db_1

Replace with

PMA_HOSTS=${WARDEN_ENV_NAME}-db-1

Worked fine.

williamdes commented 1 year ago

Awesome, closing it then Have a nice day !