Database connection error (code #2002) after installation using docker container

Installation completed successfully using docker container and connecting to a mysql container but getting Database connection error (code #2002) while trying to access the dashboard

Installation completed successfully using docker container and connecting to a mysql container but getting Database connection error (code #2002) while trying to access the dashboard

Try changing your database connection from localhost to 127.0.0.1, not sure it will help, but that was my issue.

The Docker container is a little bit different in that MySQL isn’t running on the same server as Mautic is installed on (you’ve actually got 2 servers in your container following the setup guide from our GitHub repo; a web server with Apache, PHP, and Mautic and a database server with MySQL). The provisioning script for the Docker image takes care of filling in most of the database credentials, you just need to re-fill the password on the first step of the installer.

As for the 2002 error code, that would imply the web server lost its connection to the database server. Any indications of this happening in any of the log files?