MySql Access Denied with password issue

Trying to get a basic mautic instance running on my local machine using docker desktop.

Using the basic docker-compose example from github, here is my docker-compose.yml:

name: xxxx-yyyy-services
volumes:
  xxyy-data:
networks:
  xxyy:

x-mautic-volumes:
  &mautic-volumes
  - ./mautic/config:/var/www/html/config:z
  - ./mautic/logs:/var/www/html/var/logs:z
  - ./mautic/media/files:/var/www/html/docroot/media/files:z
  - ./mautic/media/images:/var/www/html/docroot/media/images:z
#  - ./cron:/opt/mautic/cron:z # Uncomment this line to customize your cron configuration

services:

  xxyy-mysql:
    container_name: "xxyy-mysql"
    image: mysql:lts
    environment:
      - MYSQL_ROOT_PASSWORD=xxxxxxxx
      - MYSQL_DATABASE=xxyy_main
      - MYSQL_USER=xxxxyyyy_user
      - MYSQL_PASSWORD=xxxxyyyy
    volumes: 
      - xxyy-data:/var/lib/mysql
    ports:
      - 3306:3306      
    # command: '--mysql-native-password=ON'
    healthcheck:
      test: mysqladmin --user=xxxxyyyy_user --password=xxxxyyyy ping
      start_period: 5s
      interval: 5s
      timeout: 5s
      retries: 10
    networks:
      - xxyy


  mautic_web:
    container_name: "xxyy-mautic-web"
    image: mautic/mautic:latest
    ports:
      - 8080:80
    volumes: *mautic-volumes
    links:
      - xxyy-mysql:mysql
    environment:
      - DOCKER_MAUTIC_LOAD_TEST_DATA=false
      - MAUTIC_DB_HOST=xxyy-mysql
      - MAUTIC_DB_PORT=3306
      - MAUTIC_DB_DATABASE="mautic_db"
      - MAUTIC_DB_USER="xxxxyyyy_user"
      - MAUTIC_DB_PASSWORD="xxxxyyyy"
      - MAUTIC_MESSENGER_DSN_EMAIL="doctrine://default"
      - MAUTIC_MESSENGER_DSN_HIT="doctrine://default"
    healthcheck:
      test: curl http://localhost
      start_period: 5s
      interval: 5s
      timeout: 5s
      retries: 100
    depends_on:
      xxyy-mysql:
        condition: service_healthy
    networks:
      - xxyy

You can see with the commented out command in the mysql server that I tried setting mysql-native-password=ON.

I have also tried just using the root user to connect to the mysql DB with the same issue.

The issue I am seeing in the log for mautic_web is:

MySQL response contained error: amysqladmin: connect to server at 'xxyy-mysql' failed

error: 'Access denied for user '"root"'@'172.18.0.3' (using password: YES)'

(Where “root” is whichever user I try. The same message occurs for xxxxyyyy_user)

In the MySql logs, I see this error:

2025-10-06T10:06:50.658664Z 41 [Warning] [MY-013360] [Server] Plugin sha256_password reported: ''sha256_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'

In MySql (which is up and running correctly), when I do:

SELECT user, host, plugin from mysql.user;

The xxxxyyyy_user has a plugin of caching_sha2_password

I have tried changing that plugin to mysql_native_password and I got a similar, but slightly different error.

What is the correct configuration for MySql in docker-compose so that mautic can connect?

It is worth noting that I can successfully connect to the MySql instance from the command line or other database tools using both the root user and the xxxxyyyy_user. MySql seems to be running fine and works as expected.

And just to add, yes the mautic_dbschema exists, and the behavior is the same even if I try to use the xxyy_main schema.

Hello @cleverpatrick !

I’ve noticed that you’re using Mautic V6. Are you seeing this error before, while or after executing the setup wizard?

This is before mautic even launches. It is during the startup of the service. The error is coming from the docker logs.

Any variation of authentication doesn’t seem to work. Even trying to use root and the default DB for mysql doesn’t work.

As for using v6 – I’m just using latest. If there is a more stable version, I’m happy to use that. What version would you recommend using?

I just tried switching to image: mautic/mautic:5-apachein the docker-compose and it is the same error.

Hello @cleverpatrick ,

Please try running the Mautic Wizard first. It can be related to that.