-2

I am creating my very first project and I want to use my local php environment instead of Hemestead. I created the project and now I have to create the database. I'mtrying to follow the steps of this link "https://laravel.com/docs/5.1/quickstart" and want to execute this command: php artisan migrate. When executing I take this error:

Access denied for user 'homestead'@'localhost' (using password: YES)

I read this: Access denied for user 'homestead'@'localhost' (using password: YES) but I don't understand something. What to put instead of:

DB_HOST=yourHostName
DB_DATABASE=yourDatabaseName
DB_USERNAME=yourDatabaseUsername
DB_PASSWORD=youPassword

So how to find my database name, hostname etc? I repeat I am not using Homestead.

Cœur
  • 37,241
  • 25
  • 195
  • 267
tararam
  • 21
  • 5
  • You need to put your database credentials. That's something you'd create when you create the database user. Check your local environment documentation, or read up on how to create a user in for mysql or whatever database you're using. – aynber Dec 19 '16 at 20:14
  • If not Homestead, what kind of dev environment are you using? Vagrant? MAMP? Installed Apache & MySQL yourself? – mopo922 Dec 19 '16 at 20:15
  • yes I fixed it. I have installed Apache and mysql. Thanks a lot! – tararam Dec 19 '16 at 20:34

2 Answers2

0

If you did not change anything in your homestead configuration, those are the values

DB_HOST=localhost
DB_DATABASE=homestad
DB_USERNAME=homestad
DB_PASSWORD=secret

If you are not sure about it, SSH into your homestead box and try to login using

mysql -uhomestead -psecret

Also try

mysql -uroot -psecret

And if it works you have to change them to

DB_HOST=localhost
DB_DATABASE=homestad
DB_USERNAME=root
DB_PASSWORD=secret

If it doesn't login, you probably will have to recover your MySQL password:

http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html

Antonio Carlos Ribeiro
  • 86,191
  • 22
  • 213
  • 204
0

Please be sure that you have homestead db in your phpmyadmin. If don't, please create a new one. And than, go to .env file (this is the default of mysql) fill your username database with root, and the password is (empty). I had a same problem with you about 1 or 2 months ago. I just created a new one db because I have no homestead db in my phpmyadmin. I hope this helps.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Richie Permana
  • 294
  • 3
  • 15