title: docker-compose: cannot access to phpMyAdmin from my LEMP stack
body: <p>I just created a LEMP stack (Linux, Nginx, MariaDB, PHP-FPM) with docker and docker-compose.
  But somehow, I cannot access to my database trough phpMyAdmin.</p>
  <p>When I'm trying to reach the phpMyAdmin web-server, I got these errors:</p>
  <blockquote>
  <p>MySQL said: Documentation</p>
  <p>Cannot connect: invalid settings.</p>
  <p>Packets out of order. Expected 0 received 1. Packet size=69</p>
  <p>mysqli_real_connect(): Error while reading greeting packet. PID=18</p>
  <p>mysqli_real_connect(): (HY000/2006): MySQL server has gone away</p>
  <p>phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.</p>
  </blockquote>
  <p>The rest is working fine.</p>
  <p>Here is my <code>docker-compose.yml</code> file:</p>
  <pre><code>version: &quot;3.3&quot;
  services:
  
      nougat:  #Nginx Server
          image: tutum/nginx:latest
          ports:
              - &quot;8080:80&quot;
          links:
              - papaya  # PHP-FPM service
          volumes:
              - type: bind
                source: ./nginx
                target: /etc/nginx/sites-available
  
              - type: bind
                source: ./nginx
                target: /etc/nginx/sites-enabled
  
              - type: bind
                source: ./logs/nginx-error.log
                target: /var/log/nginx/error.log
  
              - type: bind
                source: ./logs/nginx-access.log
                target: /var/log/nginx/access.log
  
      papaya:  # PHP-FPM service
          build: .
          volumes:
              - type: bind
                source: ./public
                target: /usr/share/nginx/html
  
      mango:  # MariaDB database
          image: mariadb:10.5.1
          volumes:
              - type: bind
                source: ./mango_database
                target: /var/lib/mysql
          environment:
              MYSQL_ROOT_PASSWORD: admin
  
      pomegranate:  # phpMyAdmin web-service
          image: phpmyadmin/phpmyadmin:4.9.4
          restart: always
          links:
              - mango:mysql  # MySQL database
          ports:
              - &quot;8081:80&quot;
          environment:
              PMA_HOST: mysql
              PMA_USER: root
              PMA_PASSWORD: admin
              PMA_ARBITRARY: 1
  </code></pre>
  <p>And here is my <code>Dockerfile</code>:</p>
  <pre><code>FROM php:7.4.3-fpm
  
  RUN docker-php-ext-install pdo pdo_mysql
  
  RUN apt-get update -y &amp;&amp; apt-get install -y libwebp-dev libjpeg62-turbo-dev libpng-dev libxpm-dev \
      libfreetype6-dev
  
  RUN apt-get update &amp;&amp; \
      apt-get install -y \
          zlib1g-dev 
  
  RUN apt-get install -y libzip-dev
  
  RUN docker-php-ext-install zip
  
  RUN docker-php-ext-install gd
  </code></pre>
  <p>Thank you for your help in advance.</p>