# MySql Access Denied with password issue

**URL:** <https://forum.mautic.org/t/mysql-access-denied-with-password-issue/36692>\
**Category:** Docker support\
**Created:** [October 6, 2025, 10:41am UTC](https://forum.mautic.org/t/mysql-access-denied-with-password-issue/36692 "2025-10-06T10:41:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cleverpatrick](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/cleverpatrick/32/14488_2.png) [@cleverpatrick](https://forum.mautic.org/u/cleverpatrick)\
**Post date:** [October 6, 2025, 10:41am UTC](https://forum.mautic.org/t/mysql-access-denied-with-password-issue/36692/1 "2025-10-06T10:41:22Z")

</div>

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

Using the [basic docker-compose example](https://github.com/mautic/docker-mautic/blob/50c296f15ad1e4a82a172de489f8a2e1ff2207ec/examples/basic/docker-compose.yml) from github, here is my docker-compose.yml:

```yaml
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:

```auto
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:

```auto
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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![cleverpatrick](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/cleverpatrick/32/14488_2.png) [@cleverpatrick](https://forum.mautic.org/u/cleverpatrick)\
**Post date:** [October 6, 2025, 11:47am UTC](https://forum.mautic.org/t/mysql-access-denied-with-password-issue/36692/2 "2025-10-06T11:47:01Z")

</div>

And just to add, yes the `mautic_db`schema exists, and the behavior is the same even if I try to use the xxyy\_main schema.

---

<div class="post-metadata">

**Author:** ![cibero42](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/cibero42/32/14324_2.png) [@cibero42](https://forum.mautic.org/u/cibero42)\
**Post date:** [October 7, 2025, 12:32pm UTC](https://forum.mautic.org/t/mysql-access-denied-with-password-issue/36692/3 "2025-10-07T12:32:28Z")

</div>

Hello @cleverpatrick !

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

---

<div class="post-metadata">

**Author:** ![cleverpatrick](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/cleverpatrick/32/14488_2.png) [@cleverpatrick](https://forum.mautic.org/u/cleverpatrick)\
**Post date:** [October 7, 2025, 1:52pm UTC](https://forum.mautic.org/t/mysql-access-denied-with-password-issue/36692/4 "2025-10-07T13:52:39Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![cleverpatrick](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/cleverpatrick/32/14488_2.png) [@cleverpatrick](https://forum.mautic.org/u/cleverpatrick)\
**Post date:** [October 7, 2025, 1:53pm UTC](https://forum.mautic.org/t/mysql-access-denied-with-password-issue/36692/5 "2025-10-07T13:53:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cibero42](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/cibero42/32/14324_2.png) [@cibero42](https://forum.mautic.org/u/cibero42)\
**Post date:** [October 7, 2025, 6:06pm UTC](https://forum.mautic.org/t/mysql-access-denied-with-password-issue/36692/6 "2025-10-07T18:06:06Z")

</div>

Hello @cleverpatrick ,

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

---

<div class="post-metadata">

**Author:** ![marcus42](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@marcus42](https://forum.mautic.org/u/marcus42)\
**Post date:** [October 9, 2025, 3:01pm UTC](https://forum.mautic.org/t/mysql-access-denied-with-password-issue/36692/7 "2025-10-09T15:01:00Z")

</div>

This MySQL error usually pops up for 2 reasons:

1. bad username/password
2. disallowed origin

If you’re certain about the username and password, then it’s the second possibility (the 172.18.0.3 host isn’t in the allowed origins)

Potential fix:  
` - MYSQL_ROOT_PASSWORD=xxxxxxxx`  
` - MYSQL_DATABASE=xxyy_main`  
` - MYSQL_USER=xxxxyyyy_user`  
` - MYSQL_PASSWORD=xxxxyyyy`  
` - MYSQL_ROOT_HOST=172.18.0.3`

Or, to allow any origin:  
` - MYSQL_ROOT_PASSWORD=xxxxxxxx`  
` - MYSQL_DATABASE=xxyy_main`  
` - MYSQL_USER=xxxxyyyy_user`  
` - MYSQL_PASSWORD=xxxxyyyy`  
` - MYSQL_ROOT_HOST=%`
