3
votes

I was developing a laravel application locally on Mac connecting to a mysql database. i recently found out about homestead and pulled my app over to Vagrant Homestead. however now im not able to connect to the mysql server on the homestead/box.

Error i recieve:

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

I did update my app's .env file

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

I cleared my app's cache

php artisan cache:clear

I updated my /etc/hosts file

27.0.0.1        localhost
255.255.255.255 broadcasthost
::1             localhost
127.0.0.1       laravel.app

and i also removed the old mysql server running on port 3306 on 127.0.0.1. but still recieve the connection error.

Any help would be great.

1
Please show you /config/database.php - Alexey Mezenin
@AlexeyMezenin laravel.io/bin/GyOEm - user4258584

1 Answers

1
votes

Both .env and /config/database.php are looking fine, so try to run this:

php artisan config:cache