1
votes

Sorry my poor english. I'm learning Laravel. I've tried do a migration (php artisan migrate) and i get this error message:

[PDOException]
SQLSTATE[HY000] [1045] Access denied for user 'homest
ead'@'localhost' (using password: YES)

Laravel is trying connecting using user homestead... however my database config file specify using root as user to connect to the database:

enter image description here

What's going wrong?

Thanks for any help.

3

3 Answers

2
votes

Go to .env(at the root of your project) and overwrite the Database information there. like this

DB_HOST=localhost
DB_DATABASE=lixo
DB_USERNAME=root
DB_PASSWORD=segredo
1
votes

For homestead the default username is Homestead and password is secret.

0
votes

In .env file:

DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=DBName
DB_USERNAME=root
DB_PASSWORD=password

Close the laravel application server and restart again for clearing the cache.

 php artisan serve

try it!