Jonas Frese
Jonas Frese

Reputation: 108

Shopware 6 Docker Setup add PHPMyAdmin

I am a totally beginner at Shopware and I want to use PhpMyAdmin for my local Shopware 6 setup.

For the download I used the official Shopware 6 Development repository https://github.com/shopware/development

I've already seen that the docker-compose.yml has implemented the following:

app_mysql:
    build: dev-ops/docker/containers/mysql
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_USER: app
      MYSQL_PASSWORD: app
    networks:
      shopware:
        aliases:
          - mysql

and now I want to implement phpmyadmin. I tried the following:

phpmyadmin:
      image: phpmyadmin/phpmyadmin
      links:
          - app_mysql:mysql
      depends_on:
          - app_mysql
      ports:
          - 8181:80
      environment:
          PMA_HOST: app_mysql
          MYSQL_ROOT_PASSWORD: root
          MYSQL_USER: app
          MYSQL_PASSWORD: app

phpmyadmin is visible on localhost:8181 but when I try to login I get the following errors:

mysqli::real_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known mysqli::real_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known

How can I solve it?

Upvotes: 5

Views: 1805

Answers (5)

Dawid Lewandowski
Dawid Lewandowski

Reputation: 43

Also, I often like to use a just Adminer PHP binary file without docker.

Run this within the public directory:

wget https://github.com/vrana/adminer/releases/download/v4.8.1/adminer-4.8.1.php -O adminer.php

Then go to http://localhost:8000/adminer.php, enter your credentials, and you’ll have a nice interface to access your database.

Additionally, IDEs such as PhpStorm provide built-in interfaces to interact with databases.

Upvotes: 0

Neo Anderson
Neo Anderson

Reputation: 6360

Usually phpmyadmin should be in the same network as the database.
Service names are resolved to the IP addresses of the containers, therefore it's recommended to use names allowed by RFC1035 to avoid additional problems.

I removed links:, aliases, depends_on that are deprecated/not required and ended up with this docker-compose.yml.

version: '3.7'
services:
  app-mysql:
    #build: dev-ops/docker/containers/mysql
    image: mysql
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_USER: app
      MYSQL_PASSWORD: app
    networks:
      - shopware
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    ports:
        - 8181:80
    environment:
      PMA_HOST: app-mysql
      PMA_PORT: 3306
      PMA_ARBITRARY: 1
    networks:
      - shopware
networks:
  shopware

Run the containers:

docker-compose up

Open http://localhost:8181/index.php in a browser. Use

Server:    app-mysql
Username:  root
Password:  root

Enjoy:

enter image description here

Upvotes: 7

user2863520
user2863520

Reputation: 1

You should link phpmyadmin and mysql using

links:
      - app_mysql:mysql

use it as :

links:
      - mysql

Add environment:

`PMA_HOST`: mysql

Upvotes: 0

Valerio8787
Valerio8787

Reputation: 905

It is not an answer, but try http://localhost:8001/ it is not phpMyAdmin but it is another tool Adminer :)

Upvotes: 0

Shyim
Shyim

Reputation: 864

You must use as host mysql or app_mysql

Upvotes: 0

Related Questions