How can we solve “SQLSTATE[HY000] [1045] Access denied” issue with Laravel

2.95K viewsTechnology

How can we solve “SQLSTATE[HY000] [1045] Access denied” issue with Laravel

How can we fix: SQLSTATE[HY000] [1045] Access denied for user ‘root’@’localhost’ (using password: NO) (SQL: select * from `sessions` where `id` = zuG54ghzLhCLCHeHHgKeqrxFrX1dzlwX8QpqMiz2 limit 1) issue in Laravel.

Saadh Jawwadh Answered question February 10, 2022
2

Thank you Sugesh! for the reference however It couldn’t solve my issue.
However, Now I understood and solved the issue is with the environment; Laravel is not clearing the environment when we updated it so the easiest way around is.

Clearing the config cache with

php artisan config:clear

And Clear all other caches with

php artisan optimize:clear

And edit the .env file before uploading it to the original site.

Here are my references:
Laravel Artisan Cache Commands Explained – DEV Communityphp – SQLSTATE[HY000] [1045] Access denied for user ‘username’@’localhost’ (using password: YES) – Stack Overflow

Saadh Jawwadh Answered question February 10, 2022
1
You are viewing 1 out of 2 answers, click here to view all answers.