Why is the following error occurring?
QueryException SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)
My .env
file is as follows:
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:P7auDP3AGgfkYLPbu+2/m7RCLc42Sip/HuXLLQFZiYs=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=student_management
DB_USERNAME=root
DB_PASSWORD=
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With