3

I am new in Laravel 5.2.

I am getting following error:

[PDOException]
 SQLSTATE[28000] [1045] Access denied for user 'homestead'@'localhost' (usin
 g password: YES)

While I execute following command:

 php artisan migrate 

I am running application using vagrant on windows PC. Please let me know why I am getting above error.

Machavity
  • 30,841
  • 27
  • 92
  • 100
P. Jhon
  • 35
  • 6
  • Are you firing this command from your virtual machine, or from your host machine? In other words, did you make a `vagrant ssh` before making this command? – Hammerbot Nov 10 '16 at 12:15
  • yes, I am executing above command from virtual machine – P. Jhon Nov 10 '16 at 12:33
  • This error was due to `caching-issue` of the `.env.php` file cause Laravel 5 is using environment based configuration in your `.env`file. You can find the answer in this link. http://stackoverflow.com/questions/29756194/access-denied-for-user-homesteadlocalhost-using-password-yes – Manish Nov 10 '16 at 12:38

2 Answers2

1

You must set the database connection in .env file.

Balazs Szabo
  • 51
  • 1
  • 7
1

You are getting above error because on your .env file. If you open that from your project base directory then you will following default configuration:

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

Just change above values according to your development environment. Try again, Hopefully that would resolve your issue.

Plycoder
  • 721
  • 1
  • 6
  • 18