SQLSTATE[HY000] [2002] Connection refused within Laravel homestead
<p>Using Mac OS X and Homestead 2.2.1 with Laravel 5.2.</p>

<p>In terminal (within homestead in my project folder) I can do php artisan to see all the available commands. When I try to run php artisan migrate I get a connection error:<br>
<code>SQLSTATE[HY000] [2002] Connection refused</code></p>

<hr>

<p>I have setup a Laravel project with these <strong>.env</strong> settings  </p>

<pre><code>DB_HOST=127.0.0.1
DB_DATABASE=tcv
DB_USERNAME=homestead
DB_PASSWORD=secret
</code></pre>

<p>I have also tried <em>localhost</em> for DB_HOST and <em>root</em> for DB_USERNAME and DB_PASSWORD. And all possible variations of these put together!  </p>

<hr>

<p>In Sequel Pro (db management application) I CAN connect with these settings</p>

<pre><code>Host       127.0.0.1
Username   homestead
Password   secret
Database   tcv
Port       33060
</code></pre>

<p>But this database is obviously empty, because I cant migrate to it from terminal ...</p>

<p>As far as I can make out it is a configuration issue, since I can connect to it with Sequel Pro. But I have honestly no freaking idea what is setup wrong.</p>

<p>Thanks for the help !!</p>

<p><strong>EDIT</strong><br>
For some reason I get the same <code>SQLSTATE[HY000] [2002] Connection refused</code> error when moving my project to MAMP and running php artisan migrate.<br>
Now I am completely lost  ... </p>