Skip to content
Advertisement

Laravel: SQLSTATE HY000 2002 No connection could be made because the target machine actively refused it

I am trying to migrate migrations to MySQL database using php artisan migrate in Laravel 5.2’s Homestead on my local machine. I keep getting this error:

JavaScript

I can connect to the database just fine using MySQL workbench, but I want to use laravel’s migration feature.

My database.php looks like this:

JavaScript

Has anyone had this problem before?

Advertisement

Answer

Use these default settings in your .env file:

JavaScript

Also, be sure homestead database is created.

The thing is .env settings override database.php ones.

Documentation

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement