Your software
My Mautic version is: 2.16.2
My PHP version is: 7.2
NGINX webserver
Your problem
My problem is:
I am trying to migrate a mautic instance from AWS to Digital Ocean.
I have made a tar of the mautic directory, made a dump of the sql and copied everything to new server.
Created new DB with permissions for mauticuser and my password
I went and checked local.php that all the information is correct.
Went to the site and get the Database connection error (code #0).
Checked the mautic.error log and see there is a problem connecting to the DB.
Did a manual connect to the DB with user and password and localhost and am able to access it.
Changed localhost in local.php to 127.0.0.1 and still unable to connect.
Cleared cache before each try.
These errors are showing in the log:
PHP message: Database connection error (code #0) - in file /var/www/mautic/app/AppKernel.php - at line 128" while reading response header from upstream, client: 46.116.237.17, server: mydomain.com, request: “GET / HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.2-fpm.sock:”, host: “mydomain.com”
2020/07/14 10:24:12 [error] 11124#11124: *49 FastCGI sent in stderr: "PHP message: PDOException: SQLSTATE[HY000] [1045] Access denied for user ‘mauticuser’@‘localhost’ (using password: YES) in /var/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43
Stack trace:
#0 /var/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(43): PDO->__construct(‘mysql:host=127…’, ‘mauticuser’, ‘MYPASSWORD’, Array)
#1 /var/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php(44): Doctrine\DBAL\Driver\PDOConnection->__construct(‘mysql:host=127…’, ‘mauticuser’, ‘MYPASSWORD’, Array)
#2 /var/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(360): Doctrine\DBAL\Driver\PDOMySql\Driver->connect(Array, ‘mauticuser’, ‘MYPASSWORD’, Array)
#3 /var/www/mautic/app/AppKernel.php(125): Doctrine\DBAL\Connection->connect()
#4 /var/www/mautic/app/middlewares/CORSMiddleware.php(93): AppKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#5 /var/www/mautic/app/middlewares/CatchExceptionMiddlew…
PHP message: Database connection error (code #0) - in file /var/www/mautic/app/AppKernel.php - at line 128" while reading response header from upstream, client: 46.116.237.17, server: mydomain.com, request: “GET / HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.2-fpm.sock:”, host: “mydomain.com”
Steps I have tried to fix the problem:
Changing local.php file to 127.0.0.1
Clearing Cache before each try