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

623 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

Hi Saadh,

Please check this article this may help you out.
https://stackoverflow.com/questions/58233866/sqlstatehy000-1045-access-denied-for-user-rootlocalhost-using-password

Sugesh Ahamed Answered question February 10, 2022
0