title: Can't connect to Mysql server with Laravel 5.2
body: <p>When i add a MySQL connection to my laravel installation it does not seem to work. I double checked every setting, also on the remote server. The credentials are correct and everything should work. Underneath I'll post my controler, view and the database.config files so you can see what's wrong. I've been trying to fix this for the past 2 hours and I just have no idea what is wrong :( When i test if there's data it doesn't say the table does not exist, it just returns null. (I do have select permissions)</p>
  
  <p>Controller</p>
  
  <pre><code>    &lt;?php
  
  namespace App\Http\Controllers;
  
  use DB;
  use App\Log;
  
  class DataController extends Controller
  {
      public function index()
      {
          $logs = Log::distinct()-&gt;select(['device_name','device_id'])-&gt;get();
  
          return view('data.index', compact('logs'));
      }
  
      public function show($device_id)
      {
          $logs = DB::table('datalog_net_data')-&gt;take(100);
          return view('data.show', compact('logs'));
      }
      public function dashboard()
      {
          $pageTitle = "Dashboard";
          return view('data.dashboard', compact('pageTitle'));
      }
  }
  </code></pre>
  
  <p>The database config file </p>
  
  <pre><code>&lt;?php
  
  return [
  
      /*
      |--------------------------------------------------------------------------
      | PDO Fetch Style
      |--------------------------------------------------------------------------
      |
      | By default, database results will be returned as instances of the PHP
      | stdClass object; however, you may desire to retrieve records in an
      | array format for simplicity. Here you can tweak the fetch style.
      |
      */
  
      'fetch' =&gt; PDO::FETCH_CLASS,
  
      /*
      |--------------------------------------------------------------------------
      | Default Database Connection Name
      |--------------------------------------------------------------------------
      |
      | Here you may specify which of the database connections below you wish
      | to use as your default connection for all database work. Of course
      | you may use many connections at once using the Database library.
      |
      */
  
      'default' =&gt; 'mysql',
  
      /*
      |--------------------------------------------------------------------------
      | Database Connections
      |--------------------------------------------------------------------------
      |
      | Here are each of the database connections setup for your application.
      | Of course, examples of configuring each database platform that is
      | supported by Laravel is shown below to make development simple.
      |
      |
      | All database work in Laravel is done through the PHP PDO facilities
      | so make sure you have the driver for your particular database of
      | choice installed on your machine before you begin development.
      |
      */
  
      'connections' =&gt; [
  
          'sqlite' =&gt; [
              'driver'   =&gt; 'sqlite',
              'database' =&gt; database_path('database.sqlite'),
              'prefix'   =&gt; '',
          ],
  
          'mysql' =&gt; [
              'driver'    =&gt; 'mysql',
              'host'      =&gt; '192.168.1.113',
              'database'  =&gt; 'gs_database',
              'username'  =&gt; 'laravel',
              'password'  =&gt; '1234',
              'charset'   =&gt; 'Pneunet44',
              'collation' =&gt; '',
              'prefix'    =&gt; '%',
              'strict'    =&gt; false,
              'engine'    =&gt; null,
          ],
  
          'pgsql' =&gt; [
              'driver'   =&gt; 'pgsql',
              'host'     =&gt; env('DB_HOST', 'localhost'),
              'database' =&gt; env('DB_DATABASE', 'forge'),
              'username' =&gt; env('DB_USERNAME', 'forge'),
              'password' =&gt; env('DB_PASSWORD', ''),
              'charset'  =&gt; 'utf8',
              'prefix'   =&gt; '',
              'schema'   =&gt; 'public',
          ],
  
          'sqlsrv' =&gt; [
              'driver'   =&gt; 'sqlsrv',
              'host'     =&gt; env('DB_HOST', 'localhost'),
              'database' =&gt; env('DB_DATABASE', 'forge'),
              'username' =&gt; env('DB_USERNAME', 'forge'),
              'password' =&gt; env('DB_PASSWORD', ''),
              'charset'  =&gt; 'utf8',
              'prefix'   =&gt; '',
          ],
  
      ],
  
      /*
      |--------------------------------------------------------------------------
      | Migration Repository Table
      |--------------------------------------------------------------------------
      |
      | This table keeps track of all the migrations that have already run for
      | your application. Using this information, we can determine which of
      | the migrations on disk haven't actually been run in the database.
      |
      */
  
      'migrations' =&gt; 'migrations',
  
      /*
      |--------------------------------------------------------------------------
      | Redis Databases
      |--------------------------------------------------------------------------
      |
      | Redis is an open source, fast, and advanced key-value store that also
      | provides a richer set of commands than a typical key-value systems
      | such as APC or Memcached. Laravel makes it easy to dig right in.
      |
      */
  
      'redis' =&gt; [
  
          'cluster' =&gt; false,
  
          'default' =&gt; [
              'host'     =&gt; env('REDIS_HOST', 'localhost'),
              'password' =&gt; env('REDIS_PASSWORD', null),
              'port'     =&gt; env('REDIS_PORT', 6379),
              'database' =&gt; 0,
          ],
  
      ],
  
  ];
  </code></pre>
  
  <p>The return when i var_dump the first log row 
  <a href="http://puu.sh/nJLtV/028b2b5192.jpg" rel="nofollow">http://puu.sh/nJLtV/028b2b5192.jpg</a></p>
  
  <p>I hope you guys know, because i have no idea.</p>