Monday, August 17, 2015

are you stack with this annoying error on your laravel together with vagrant homestead configuration?

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

this time i used vagrant and after running this command;

 php artisan migrate

i got this error, and i think i setup properly my configurations, until i found out on laravel documentation about this .env file;

the solution is, from your .env file on your root directory change the ff;


DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

DB_HOST=127.0.0.1
DB_DATABASE={your database name}
DB_USERNAME=homestead
DB_PASSWORD=secret

then run php artisan migrate again and boom.... you get this message

Migration table created successfully.

and i give credit on this thread

if error still the same, you can simply run this command on the terminal

php artisan config:cache


1 comments: