Why is the following error occurring?
QueryException SQLSTATE[HY000] [1045] Access denied for user \'homestead\'@\'localhost\' (using password: YES)
You should clear the cache after changing info in the .env file.
Run the following commands:
php artisan cache:clear
php artisan config:clear
php artisan config:cache
It's either you edit a wrong file or you have not saved the .env
yet. Because in your error message, it looks like you access the database using user homestead on localhost database, not root on student_management. Make sure you edit the correct .env
, not .env.example
. cheers
You can use these commands to solve the problem
php artisan cache:clear
php artisan config:clear
php artisan config:cache
These commands are use to clear the cache.
Add the blank quotes in front of password like this
DB_PASSWORD=""
In the case if you have an empty password.
Hope this solution will work
Cleaning out the system caches...for example for the PhpMyStorm IDE
On the main menu, choose File | Invalidate Caches/Restart. The Invalidate Caches message appears informing you that the caches will be invalidated and rebuilt on the next start. Use buttons in the dialog to invalidate caches, restart PhpStorm or both.