Search code examples
phplaravellaravel-9

Get password authentication failed after update Laravel to version 9


Previously I had a Laravel app with Laravel 5.7, and now I updated my app to newest Laravel 9 version. But I get an error with my pgsql connection password, even though my .env it's still same.

I try to connect with pgadmin, dbeaver and it's working, only in laravel that get an error.

I already run php artisan cache:clear and php artisan config:cache but the problem still remain.

.env part

DB_CONNECTION=pgsql
DB_HOST=159.x.x.x
DB_PORT=5432
DB_DATABASE=infinite-mob
DB_USERNAME=user
DB_PASSWORD=password

laravel.log

[previous exception] [object] (PDOException(code: 7): SQLSTATE[08006] [7] FATAL:  password authentication failed for user \"user\"
FATAL:  password authentication failed for user \"user\" at /var/www/app.ics-seafood.com/app_laravel9/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70)

Solution

  • Its turn out my password is a complex password, like

    S3cur1ti%$#@!

    so adding "" in DB_PASSWORD .env solved the problem

    like this

    DB_PASSWORD="S3cur1ti%$#@!"