title: Docker MySQL connection DBeaver
body: <p>I just finished following this Docker tutorial on youtube:</p>
  
  <p><a href="https://www.youtube.com/watch?v=SXY0MLHP3hA&amp;lc=Ugzp3vKtSOp0rn2lYyd4AaABAg" rel="noreferrer">https://www.youtube.com/watch?v=SXY0MLHP3hA&amp;lc=Ugzp3vKtSOp0rn2lYyd4AaABAg</a></p>
  
  <p>I was able to create a couple of Docker containers for PHP and MySQL.  The file structure is as follows:</p>
  
  <pre><code>&gt;Docker_PHP_MySQL
   &gt;DB
     -Dockerfile
   &gt;src
     -index.php
   &gt;www
     -Dockerfile
   development.env
   docker-compose.yml
  </code></pre>
  
  <p>The DB Dockerfile:</p>
  
  <pre><code>FROM mysql:8.0
  </code></pre>
  
  <p>index.php:</p>
  
  <pre><code>&lt;?php
  $mysqli = new mysqli('tut07-db', getenv('MYSQL_USER'), getenv('MYSQL_PASSWORD'), 'information_schema');
  if($mysqli-&gt;connect_error) 
  {
    echo 'Connection Error [', $mysqli-&gt;connect_errno, ']: ', $mysqli-&gt;connect_error;
  } 
  else 
  {
    echo 'MySQLi Connected Successfully!';
  }
  ?&gt;
  </code></pre>
  
  <p>The www Dockerfile:</p>
  
  <pre><code>FROM php:7.2-apache
  
  RUN docker-php-ext-install mysqli
  RUN docker-php-ext-enable mysqli
  </code></pre>
  
  <p>Here is the development.env file:</p>
  
  <pre><code>MYSQL_USER=sys_admin
  MYSQL_PASSWORD=sys_password
  MYSQL_ROOT_PASSWORD=root_password
  </code></pre>
  
  <p>And then finally, the docker-compose.yml file:</p>
  
  <pre><code>version: "3"
  
  networks:
    tut07-frontend:
      driver: bridge
      ipam:
        driver: default
        config:
          - subnet: 172.10.1.0/24
    tut07-backend:
      driver: bridge
      ipam: 
        driver: default
        config:
          - subnet: 172.10.2.0/23
  
  services:
    tut07-db:
      build: ./db
      command: --default-authentication-plugin=mysql_native_password
      ports:
        - 3306:3306
      networks:
        tut07-backend:
          ipv4_address: 172.10.3.2
      env_file:
        - ./development.env
    tut07-www:
      build: ./www
      ports:
        - 8080:80
      volumes:
        - ./src:/var/www/html/
      networks:
        tut07-backend:
          ipv4_address: 172.10.2.2
        tut07-frontend:
          ipv4_address: 172.10.1.2
      depends_on:
        - tut07-db
      env_file:
        - ./development.env
  </code></pre>
  
  <p>Now here's where I know I'm going in completely blind...</p>
  
  <p>In dbeaver, I'm trying to establish a connection:</p>
  
  <p><a href="https://i.stack.imgur.com/Sljzm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Sljzm.png" alt="enter image description here"></a></p>
  
  <p>But when I test the connection, I get the following response:</p>
  
  <p><a href="https://i.stack.imgur.com/14kB4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/14kB4.png" alt="enter image description here"></a></p>
  
  <p>How do I fix this problem?</p>