Prestashop: Database connection fail(uses old parameters instead of new ones)

Created on 13 Oct 2018  路  7Comments  路  Source: PrestaShop/PrestaShop

Describe the bug
After migrating to another servers, the following error occurs:
PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000] [1045] Access denied for user 'olduser'@'localhost' (using password: YES) in /domain.com/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43
Stack trace:

0 /domain/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(43): PDO->__construct('mysql:host=127....', 'olduser', password', Array)

1 /domain/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php(44): Doctrine\DBAL\Driver\PDOConnection->__construct('mysql:host=127....', 'olduser', 'password', Array)

2 /domain/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(360): Doctrine\DBAL\Driver\PDOMySql\Driver->connect(Array, 'olduser', 'password', Array)

3 /domain/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(942): Doctrine\DBAL\Connection->connect()

4 /domain/mun in /domain/vendor/twig/twig/lib/Twig/Loader/Chain.php on line 129

This only happens in certain BO pages(all the ones that require configuration for example, i get this error), funny thing is that this ONLY occurs when DEBUG mode is OFF, when debug mode is enabled i don't get this error. This is the oddest thing I've faced by now.

To Reproduce
Steps to reproduce the behavior:
Migrate from one server to another and after making all the changes the error can be reproduced.
Changing database user and name is mandatory, since as you can see in the error log the problem is that it's using the OLD user and database instead of the new ones. Parameters.php have been modified accordingly to new user and database.

Additionnal information
PrestaShop version: 1.7.4.2
PHP version: 7.1

No change required

Most helpful comment

After debugging a lot in my server this is what solved for me:

at prestashop/var/cache remove all files and now the BO cache is cleared, i think this should be cleaned too when you click on "clear cache" in the BO.

Closed

All 7 comments

And yes, i've checked the cache and it's empty.
The strange thing is that the front office works perfectly but BO can't connect to the database, which is super strange.

After debugging a lot in my server this is what solved for me:

at prestashop/var/cache remove all files and now the BO cache is cleared, i think this should be cleaned too when you click on "clear cache" in the BO.

Closed

Hi @ChineseNorris,

Since it fixed, I close the issue, feel free to open a new one when needed.
Thanks!

Hello everybody,

I arrived here because of such connection issue; I'd like to share my experience in case somebody can find it useful.

I'm not quite sure, but I think this is a bug: during installation I've put some password, and then at app/config/parameters.php the password had an extra '%' character after a specific '%' character that was already there. Neither /admin or homepage worked, obviously.

Greetings from Argentina.

Hi @UniversoSistemas,

Similar issue reported here: https://github.com/PrestaShop/PrestaShop/issues/12556

Thanks!

Yes it's unfortunately due to https://github.com/symfony/symfony-standard/issues/1084 馃槩

YES. YOU ARE RIGHT!
Check if your password contains a '%' char.
Change the pwd and check again. Problem solved!

Was this page helpful?
0 / 5 - 0 ratings