1
votes

I am new to Laravel and I already went through the documentation. I did login and register pages by using auth artisan command.

I am trying to store the values from the registration page but when I click on the submit button I get this error:

SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES) (SQL: select count(*) as aggregate from users where email = [email protected])

How do I resolve this?

2
I'm sorry, but the error message says it all: you supplied an incorrect MySQL username or password. - Shadow

2 Answers

2
votes

Open the directory where you have installed the laravel. Find the ".env" file and edit the database details there.

Or you can even setup them in the config/database.php file.

1
votes

This error occurs when we forget the configuration database file in the .env file:

SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES) (SQL: select count(*) as aggregate from users where email = [email protected])

Solution: Just need a correct configuration in the .env file:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead 
DB_USERNAME=homestead
DB_PASSWORD=secret

Don't forget to clear cache after changes:

php artisan config:cache