Inconsistent login problems using MySQL with Docker using docker-compose

First off, I want to say thank you for your time and for your willingness to help.
Secondly, I am a complete noob to Docker, only having started working with it today.

I wanted to learn how to setup Docker as the ability to have independent containers set up, 1 to each website I was to work on without depending on WAMPServer 3, was attractive. I started by following this tutorial, which seemed pretty straightforward:

I installed Docker and installed the WSL for Windows 10 with the WSL Ubuntu 20.04 and the Linux Kernel Update for WSL.

I was able to get the tutorial, as shown, to work, but wanted to customize it to be as close as possible to my Client’s webhosting provider’s server:

Apache/2.4.46
nginx/1.20.0
PHP 7.4.27 (to be upgraded to PHP 8.0 soon)
MariaDB 10.3.30 → MySQL 15.1

I am not sure how to address using Apache 2.4.46 as yet within the docker-compose.yml

I also want to use a docker-compose yaml file so as not to have to use a command line:

My docker-compose.yml is as follows:

version: '3.9'
services:
    web:
        image: nginx:1.20.0
        ports:
            - "80:80"
        volumes:
            - ./nginx.conf:/etc/nginx/conf.d/nginx.conf
            - ./app:/app
    php:
        build:
            context: .
            dockerfile: PHP.Dockerfile
        volumes:
            - ./app:/app
    mysql:
        image: mariadb:10.3.30
        environment:
            MYSQL_ROOT_PASSWORD: 'secret'
            MYSQL_USER: 'schauer'
            MYSQL_PASSWORD: 'schauer'
            MYSQL_DATABASE: 'schauer'
        volumes:
#            - mysqldata:/var/lib/mysql
            - ./mysqldata:/mysqldata
        ports:
            - 3306:3306
    phpmyadmin:
        depends_on:
            - mysql
        image: phpmyadmin/phpmyadmin
        links:
            - mysql
        ports:
            - "8000:80"
        environment:
            PMA_HOST: mysql
        restart: always
volumes:
    mysqldata: {}

My PHP.Dockerfile is as follows:

FROM php:7.4.27-fpm

#RUN docker-php-ext-install pdo pdo_mysql
RUN docker-php-ext-install mysqli

RUN pecl install xdebug && docker-php-ext-enable xdebug

My nginx.conf is as follows:

server {
    listen 80 default_server;
    root /app/public;

    index index.php index.html index.htm;

    location ~ \.php$ {
        fastcgi_pass php:9000;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;     
    }
}

The structure of the project is:
a6_schauer.dkr
—app
------public
—mysqldata

These files are in the folder a6_schauer.dkr:
docker-compose.yml
nginx.conf
PHP.Dockerfile

Please note that I will be adjusting the logins appropriately once I can actually get matters working.

I can successfully connect to: 127.0.0.1:8000/ to run PHPMyAdmin and login with the credentials:
username: root
p/w: secret

Since this works, I must have been able to make a successful database connection.

Problem 1:

My workflow when working on a WordPress site is to work locally, then make a backup to be deployed remotely via use of the Duplicator plugin ( via wordpress.org/plugins/duplicator ). Duplicator also allows going from the remote server to a local server in the same fashion.

I cannot seem to connect to the database.

While in PHPMyAdmin, I created the schauer database and gave the user schauer all privileges as a temporary measure.

When I try to test the database, no matter what combination of usernames specified in the docker-compose file I try, nor host names seems to work. I’ve tried user: root, p/w: secret with the db name: schauer, with host being localhost or 127.0.0.1, and done the same with the username and password of schauer and schauer, respectively.

Note that within the PHP.Dockerfile I commented out the line with PDO_Mysql as Duplicator requires MySQLi in order to work.

Problem 2:
For Duplicator, I also cannot, as yet get the shell_exec to work nor the ability to use ZIPArchive to extract the ZIPfile that holds the WordPress site files. I can extract them manually and all works well until I get to the part where I have to connect to the database in Problem 1.

Problem 3:
I wanted to have the MySQL data files be stored in a folder underneath the project folder, but nothing seems to appear there. I am not sure if my MySQL data is really being stored under /var/lib/mysql as I don’t know how to verify anything much at this point.

I’ve also tried resetting matters via:
docker-compose down -v
docker-compose up -d

And rebuilding via:
docker-compose build

whenever I make changes to the Docker config files.

Any help would be greatly appreciated.

Thank you!