title: Laravel Homestead SQLSTATE[HY000] [2002] Connection refused after server move
body: <p>I moved an application that I'm working on into a new dev server, a Laravel Homestead VagrantBox on a Mac OSX host. Upon doing so, I ran php artisan:migrate to update my database and this went through without a hitch. </p>
  
  <p>I decided to create a new user to continue testing, so I created the route</p>
  
  <pre><code>Route::get('/newuser', function()
  {
      User::create([
          'username' =&gt; 'someone',
          'email' =&gt; 'someone@someone.com',
          'password' =&gt; Hash::make('password') 
  ]);
  
  return 'Done.';
  });
  </code></pre>
  
  <p>When I visit /newuser, however. I am getting the following message. </p>
  
  <pre><code>SQLSTATE[HY000] [2002] Connection refused
  </code></pre>
  
  <p>Now, I know that my database config must be correct, as I received no errors when I ran php artisan migrate and my database migrated successfully. However, just to be safe, I checked my database config.</p>
  
  <pre><code>        'mysql' =&gt; array(
              'driver'    =&gt; 'mysql',
              'host'      =&gt; 'localhost:33060',
              'database'  =&gt; 'site',
              'username'  =&gt; 'root',
              'password'  =&gt; 'apassword',
              'charset'   =&gt; 'utf8',
              'collation' =&gt; 'utf8_unicode_ci',
              'prefix'    =&gt; '',
          ),
  </code></pre>
  
  <p>I figured that maybe there was an issue with the way I defined the port I was on, so I added the parameter:</p>
  
  <pre><code>'port' =&gt; '33060'
  </code></pre>
  
  <p>Upon doing this, the error message changed from "Connection refused" to "No such file or directory"</p>
  
  <p>I'm at a loss. Does anyone have any pointers?</p>