Support the ongoing development of Laravel.io →
Configuration Database

I have setup Laravel and trying to run the artisan migrate command however I am getting the error [PDOException]
SQLSTATE[HY000] [2002] Connection refused.

I am not sure how db is setup in Homestead. So I got the below questions.

  1. Is default database created automatically by artisan migrate or Homestead? If it is, what is the name?
  2. If its not created by default, should we create before running migration?
  3. I tried loggin in to MySQL db by connecting to Homestead VM using ssh and then running MySQL. However I get error "Access denied for user...." for user name vagrant, Homestead and forge. What is the default credentials?

I understand that creating MySQL db is out of the scope of Laravel tutorial; So it would be helpful if anyone can answer these questions and point me in right direction. Thanks.

Last updated 3 years ago.
0
Last updated 3 years ago.
0

Yes I did and it does not talk about creation database before running migration. I did whatever is mentioned and it does not work.

I wonder how would it work without setting up the db? It would be great if anyone can answer my questions.

Last updated 3 years ago.
0

Thanks a lot, solved it with your answer.

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

scribnar scribnar Joined 26 Aug 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.