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

calumshep's avatar

Homestead - Laracasts Database Migrations: php artisan migrate Error

Hello,

I am using Laravel Homestead to run projects following along with the Laravel from Scratch Laracasts series. I am using a fresh Homestead installation with a new blank Laravel project, and upon running php artisan migrate (or other commands) am presented with one of two errors. When the DB_HOST=127.0.0.1 in my .env file, I get the following Connection refused error: https://imgur.com/U7PMB7l. When using DB_HOST=localhost I get the following different error: https://imgur.com/vA85BEL.

Any suggestions?

0 likes
5 replies
tykus's avatar

Since you are running the migrations from the host, you should set the DB_HOST to 192.168.10.10 which is the Homestead IP address.

2 likes
calumshep's avatar

@TYKUS - It was that simple...and made a lot of sense. I've not been able to find that in the documentation anywhere so perhaps for those new to migrations/VM dev envs it may be worth including that somewhere? Or maybe I wasn't looking hard enough. Thanks anyway!

tykus's avatar

No worries, please mark the best reply above to help others

calumshep's avatar

@TYKUS - I would but I was unable to click it on Chrome on my Mac as it constantly changed state when hovering over and on iOS Chrome it just throws a 404 clicking Best Answer

leecolarelli's avatar

This needs to be in the laravel homestead documentation... there's very little reference to using it with databases and artisan.

Please or to participate in this conversation.