Shopware 6 Docker Setup add PHPMyAdmin
Asked Answered
U

5

5

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?

Utopianism answered 3/9, 2020 at 10:31 Comment(1)
For local setup you could also use Dockware (dockware.io). Dockware comes with a complete docker setup for development and has adminer per default (/adminer.php)Surety
I
7

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

Intradermal answered 3/9, 2020 at 17:37 Comment(1)
I did but at least I have less than 15 rep and that's why it is not shown public :DUtopianism
L
0

You must use as host mysql or app_mysql

Lutes answered 3/9, 2020 at 11:12 Comment(1)
I used in the environment section app_mysql for PMA_HOST. What do you mean?Utopianism
S
0

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

Similar answered 3/9, 2020 at 11:16 Comment(0)
A
0

You should link phpmyadmin and mysql using

links:
      - app_mysql:mysql

use it as :

links:
      - mysql

Add environment:

`PMA_HOST`: mysql
Arlyne answered 3/9, 2020 at 11:39 Comment(1)
Thanks but why should I use mysql as linking instead of app_mysql:mysql when the sql service is named app_mysql? That causes an undefined service linking when I restart the project :/Utopianism
G
0

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.

Gewirtz answered 6/11 at 19:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.