Ben Borgers

Artisan commands not working in fresh Laravel installation

December 11, 2020

I just created a new Laravel app and installed Jetstream, and when I went to run php artisan serve it hung and didn’t do anything.

Then, I tried to run php artisan migrate, and it also stalled for a while before giving me an error that the database connection had timed out.

This was weird, because it was a completely fresh installation of Laravel and Jetstream with no changes made.

I eventually realized that the issue lay in the .env file. The new Laravel installation has a .env file with these values:


The DB_HOST variable is no longer set to localhost, like it used to be, but my local MySQL database for development is running at localhost:3306 (which is the same as

To fix it, all I had to do was uncomment the first DB_HOST line by removing the #, and then remove the line that says DB_HOST=mysql.

Then, php artisan serve and php artisan migrate worked perfectly again.

Subscribe to my newsletter!

A weekly round-up of new blog posts and updates to projects I’m working on.