title: Laravel 5.5 can't connect to database
body: <p>I have a larvael and I want it to make it in production. I have a server hosting and database on infomaniak.com. </p>
  
  <p>I have upload all my file and I get a SQL timeout error :</p>
  
  <blockquote>
    <p>SQLSTATE[HY000] [2002] Connection timed out (SQL: select * from
    <code>characters</code> where <code>checked</code> = 1 order by RAND() limit 1)</p>
  </blockquote>
  
  <p>I have an other Laravel website on infomaniak and don't have this problem. I have check my <code>.env</code> file, my <code>/config/database</code> file and try <code>php artisan config:clear</code> or <code>php artisan cache:clear</code>. I also try to dump <code>DB:connection()</code> and the connection information are right.</p>
  
  <p>I can connect to my homestead database in local and work fine. But when I try to connect to the SAME database than my other website with the same <code>.env</code> file and still have  the timeout error.</p>
  
  <p>How can I fix this ? Are there a way to clear another cache ? Completly lost :/</p>
  
  <p>EDIT :</p>
  
  <p>If i try :</p>
  
  <pre><code>if(DB::connection()-&gt;getDatabaseName()) {
      echo "Yes! successfully connected to the DB: " . DB::connection()-&gt;getDatabaseName();
  }
  </code></pre>
  
  <p>The page return <code>Yes! successfully connected to the DB: db_name</code></p>
  
  <p>EDIT 2 :</p>
  
  <p>I just see my hosting server is in PHP 5.6 but it say that's my website is in PHP 7. Really confusing but maybe this informations is important (have another laravel on this server and works like that)</p>