config sticked in laravel app on shared hosting

  caching, laravel, php

I’ve deploy a laravel API some months ago into a shared hosting (banahosting). It’s been working fine until yesterday that all API endpoints returns an error:

IlluminateDatabaseQueryException: SQLSTATE[HY000] [1045] Access denied for user '####'@'localhost' (using password: YES) (SQL: select `destinations`.*, (select count(*) from `experiences` where `destinations`.`id` = `experiences`.`destination_id`) as `experiences_count` from `destinations` order by `id` desc) in file /###/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 669

Its weird because no-one else than me has access to the hosting, so i supposed that maybe some strange security function of this shared hosting has changed the password of the db user so i just changed it again, updated the .env file and ran the commands to clear artisan cache but the error has remained.

I’ve tried creating a new DB user and then i found the real problem: even when i changed the db user on the .env file, the error says that the user which is trying to access is the same. I mean, the error should say something like "Access denied for user ‘NEW_USER‘@’localhost’" but instead it says "Access denied for user ‘OLD_USER‘@’localhost’"

I also tried setting directly the user and password into the file /config/database.php or deleting completely the .env file but the error is exactly the same.

The support team of the hosting tried to help me too, they told me that they cleaned the cache of the server but it didn’t work and they don’t know what could be happening.

The command after every changed i’ve tried is php artisan config:clear and php artisan config:cache, i’ve also tried with php artisan config:clear and php artisan optimize

Source: Laravel

Leave a Reply