Mysql problem

Your software
My Mautic version is:4.4.9
My PHP version is: 8.0.29
My Database type and version is:
Your problem
My problem is:
cannot connect to sql server
These errors are showing in the log:
An error occured while attempting to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user ‘user’@‘’ (using password: YES)
Steps I have tried to fix the problem: No

Hi, check your access to the DB and make sure config is properly added.
The file you need to edit: MAUTICFOLDER/app/config/local.php

Is the database on local or remote?


The database is on a local docker container.

Okay, not my table. :frowning: I hope a docker person will chime in.

Where is the source (PHP)? Another container or host?

You user probably does not have the permission to connect from the source you are connecting. You have to add a user with correct host (in case where you run php in docker container this is the name of the container). In case php (mautic source) is on the host you can add user that is allowed to connect from anywhere (%).

Check the docs for a syntax of create user: < >.

PHP is installed in Terminal. I think it is not in another container. I can connect to the mysql server in Terminal.

OK, I guess you mean php is installed on the host system and mautic app is connecting to a database inside a docker container.

Basically I think what is missing is that your database user that you are using in app/config/local.php does not have permission to connect to database inside a docker container.

I would approach the issue as follows:

  • open database port inside container to host (default database port is 3306, but you should verify that is the case in your situation).
  • then you I would add user user@ to mysql.user table (execute the create user and grant privileges) on mysql database inside docker container
  • check if I can connect from my host to database inside docker container using mysql-client on the host
  • adapt the database details inside app/config/local.php
  • clear mautic cache
  • check if it works

Thank you.