title: How to connect to MySQL database on port 3308 using laravel framework 5.1?
body: <p>I am trying to use laravel for the first time. I opned the database.php file located in the config directory and then update the mysql config.</p>
  
  <p>but every time I try to do this command 
  php artisan migrate:install</p>
  
  <p>I get this
    [PDOException]
    SQLSTATE[HY000] [2002] No connection could be made because the target machi
    ne actively refused it.</p>
  
  <p>I have to let laravel to connect to a different port somehow.</p>
  
  <p>I have tried the following and none worked.</p>
  
  <pre><code>    'mysql' =&gt; [
          'driver'    =&gt; 'mysql',
          'host'      =&gt; env('DB_HOST', '10.15.1.5'),
          'port'      =&gt; '3308',
          'database'  =&gt; env('DB_DATABASE', 'mydb_dev'),
          'username'  =&gt; env('DB_USERNAME', 'user'),
          'password'  =&gt; env('DB_PASSWORD', 'pass'),
          'charset'   =&gt; 'utf8',
          'collation' =&gt; 'utf8_unicode_ci',
          'prefix'    =&gt; '',
          'strict'    =&gt; false,
      ],
  </code></pre>
  
  <p>and this</p>
  
  <pre><code>    'mysql' =&gt; [
          'driver'    =&gt; 'mysql',
          'host'      =&gt; env('DB_HOST', '10.15.1.5:3308'),
          'database'  =&gt; env('DB_DATABASE', 'mydb_dev'),
          'username'  =&gt; env('DB_USERNAME', 'user'),
          'password'  =&gt; env('DB_PASSWORD', 'pass'),
          'charset'   =&gt; 'utf8',
          'collation' =&gt; 'utf8_unicode_ci',
          'prefix'    =&gt; '',
          'strict'    =&gt; false,
      ],
  </code></pre>
  
  <p>and this</p>
  
  <pre><code>    'mysql' =&gt; [
          'driver'    =&gt; 'mysql',
          'host'      =&gt; env('DB_HOST', '10.15.1.5'),
          'port'      =&gt; env('DB_PORT', '3308'),
          'database'  =&gt; env('DB_DATABASE', 'mydb_dev'),
          'username'  =&gt; env('DB_USERNAME', 'user'),
          'password'  =&gt; env('DB_PASSWORD', 'pass'),
          'charset'   =&gt; 'utf8',
          'collation' =&gt; 'utf8_unicode_ci',
          'prefix'    =&gt; '',
          'strict'    =&gt; false,
      ],
  </code></pre>
  
  <p>finally, I tried this</p>
  
  <pre><code>    'mysql' =&gt; [
          'driver'    =&gt; 'mysql',
          'host'      =&gt; '10.15.1.5:3308',
          'database'  =&gt; env('DB_DATABASE', 'mydb_dev'),
          'username'  =&gt; env('DB_USERNAME', 'user'),
          'password'  =&gt; env('DB_PASSWORD', 'pass'),
          'charset'   =&gt; 'utf8',
          'collation' =&gt; 'utf8_unicode_ci',
          'prefix'    =&gt; '',
          'strict'    =&gt; false,
      ],
  </code></pre>
  
  <p>this gives me a different error </p>
  
  <pre><code>Access denied for user 'homestead'@'10.xxxxxx' (using password: YES)
  </code></pre>
  
  <p>I am not sure where is the user <code>homestead</code> is coming from.</p>
  
  <p>How can I tell laravel to connect to mysql on port 3308?</p>