Docker wordpress installation on Ubuntu 20.04

Hi there what should be a straight forward installation of WordPress and PHPMyadmin on Docker on Ubuntu 20.04 is throwing errors in the STDOUT and subsequently when attempting to view WordPress in the browser I am getting a non-specific database error.

Firstly my yaml file:

version: '3'

services:
  db:
    image: mysql:8
    container_name: mysql
    restart: always
    command: '--default-authentication-plugin=mysql_native_password'   
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: wpdb
      MYSQL_USER: user
      MYSQL_PASSWORD: password

  wordpress:
    image: wordpress:5.4.1
    container_name: wordpress
    restart: always
    volumes:
      - ./wp-content:/var/www/html/wp-content
    depends_on:
      - db
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_NAME: wpdb
      WORDPRESS_USER: user
      WORDPRESS_PASSWORD: password
    ports:
      - 8080:80
      - 443:443
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    restart: always
    ports:
      - 3333:80
    environment:
      PMA_HOST: db
      MYSQL_ROOT_PASSWORD: password

And Now the output from **docker-compose up**

Starting mysql              ... done
Starting test2_phpmyadmin_1 ... done
Starting wordpress          ... done
Attaching to mysql, test2_phpmyadmin_1, wordpress
mysql         | 2020-05-13 08:25:52+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.20-1debian10 started.
mysql         | 2020-05-13 08:25:52+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
phpmyadmin_1  | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.26.0.3. Set the 'ServerName' directive globally to suppress this message
mysql         | 2020-05-13 08:25:52+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.20-1debian10 started.
mysql         | 2020-05-13T08:25:52.527362Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
mysql         | 2020-05-13T08:25:52.527443Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.20) starting as process 1
phpmyadmin_1  | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.26.0.3. Set the 'ServerName' directive globally to suppress this message
mysql         | 2020-05-13T08:25:52.534595Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
phpmyadmin_1  | [Wed May 13 08:25:52.250991 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.4.5 configured -- resuming normal operations
phpmyadmin_1  | [Wed May 13 08:25:52.251029 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
mysql         | 2020-05-13T08:25:52.671334Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
mysql         | 2020-05-13T08:25:52.773825Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060
wordpress     | [13-May-2020 08:25:52 UTC] PHP Warning:  mysqli::__construct(): (HY000/2002): Connection refused in Standard input code on line 22
wordpress     | 
wordpress     | MySQL Connection Error: (2002) Connection refused
mysql         | 2020-05-13T08:25:52.864314Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
mysql         | 2020-05-13T08:25:52.871773Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
mysql         | 2020-05-13T08:25:52.908753Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.20'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
wordpress     | [13-May-2020 08:25:55 UTC] PHP Warning:  mysqli::__construct(): (HY000/1045): Access denied for user 'root'@'172.26.0.4' (using password: NO) in Standard input code on line 22
wordpress     | 
wordpress     | MySQL Connection Error: (1045) Access denied for user 'root'@'172.26.0.4' (using password: NO)
wordpress     | 
wordpress     | MySQL Connection Error: (1045) Access denied for user 'root'@'172.26.0.4' (using password: NO)
wordpress     | 
wordpress     | MySQL Connection Error: (1045) Access denied for user 'root'@'172.26.0.4' (using password: NO)
wordpress     | 
wordpress     | MySQL Connection Error: (1045) Access denied for user 'root'@'172.26.0.4' (using password: NO)
wordpress     | 
wordpress     | MySQL Connection Error: (1045) Access denied for user 'root'@'172.26.0.4' (using password: NO)
wordpress     | 
wordpress     | MySQL Connection Error: (1045) Access denied for user 'root'@'172.26.0.4' (using password: NO)
wordpress     | 
wordpress     | MySQL Connection Error: (1045) Access denied for user 'root'@'172.26.0.4' (using password: NO)
wordpress     | 
wordpress     | MySQL Connection Error: (1045) Access denied for user 'root'@'172.26.0.4' (using password: NO)
wordpress     | 
wordpress     | MySQL Connection Error: (1045) Access denied for user 'root'@'172.26.0.4' (using password: NO)
wordpress     | 
wordpress     | WARNING: unable to establish a database connection to 'db'
wordpress     |   continuing anyways (which might have unexpected results)
wordpress     | 
wordpress     | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.26.0.4. Set the 'ServerName' directive globally to suppress this message
wordpress     | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.26.0.4. Set the 'ServerName' directive globally to suppress this message
wordpress     | [Wed May 13 08:26:19.911848 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.3.17 configured -- resuming normal operations
wordpress     | [Wed May 13 08:26:19.911906 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'

And as I said when I attempt to access WordPress on localhost:8080 I get

Error establishing a database connection

PhpMyadmin works fine on localhost:3333

Any ideas???????

Oh yes I have been following this tutorial: https://www.youtube.com/watch?v=BfrVWwJv8ls

Thanks : )

Source: StackOverflow