Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bashy's avatar

@sitesense I have been yeah. Got a project to work on out of work hours so it's taking up my time :)

1 like
sitesense's avatar

@bashy good luck with that, you're overdue a break though. Don't think I've ever been on here and not seen your posts.

You're a legend and credit to Laracasts dude! Happy weekend :)

1 like
grusch-it's avatar

This hole MySQL on homestead thing is quite tricky if you want to run migrations inside&outside homestead. To do so, you probably have two choices:

  1. Changing homesteads mysql configuration (like bashy does)
  2. Change laravels database configuration

I personally prefer #2 since the homestead configuration is something maintained externally so you would have to track your own changes and apply them on updates afterwards. But the configurations of your own projects are something maintained by yourself.

lifesound's avatar

I solved it by : in the .env file

DB_HOST=127.0.01:33060 <<<======

DB_DATABASE=homestead

DB_USERNAME=homestead

DB_PASSWORD=secret

costeeta's avatar

Nothing worked for me until I changed DB_USERNAME to 'root' instead of 'homestead'

arun3x3's avatar

I have faced the same issue. While php migration works Via SSH perfectly, from my local bash it gave me the error.I changed the Port Number to 33060 in .env file it seems to be working. Dint change anything in the database file from config folder(laravel 5.3).

educatedrisk's avatar

Trying to run "php artisan migrate" in a bash shell on Windows 10, virtual box, vagrant, homestead installation .. I was getting this error.

SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.

As per the documentation you have to run the "php artisan migrate" command in your project folder logged into the virtual machine. Found this in the documentation

https://laravel.com/docs/5.4/migrations#running-migrations

1 like
Previous

Please or to participate in this conversation.