title: PHP Connection Erreur : SQLSTATE[HY000] [2002] A connection attempt failed
body: <p>It's the first time I ask a question on a forum.</p>
  
  <p>I'm making a quizz with a basic html form and need to save the answers on my server (using lcn.com company for hosting it). 
  Server details:
  Host: database3.lcn.com
  User: xxx
  pwd: xxx</p>
  
  <p>Alright, I'm simply trying to connect to my MySQL database using PHP language.
  I've pasted here my php file:</p>
  
  <pre><code>&lt;?php
          $dsn='mysql:host=database3.lcn.com;dbname=test_table;charset=utf8';
          $user="***";
          $pwd="***";
  
          try {
              $linkpdo = new PDO ($dsn,$user,$pwd);
  
              echo "Success!";
  
              $linkpdo=null;
          } catch(Exception $e) {
  
              die('Erreur : '.$e-&gt;getMessage());
  
          }
  ?&gt;
  </code></pre>
  
  <p>But I have this problem :
  Erreur : SQLSTATE[HY000] [2002] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.</p>
  
  <p>And don't know why it doesn't work...</p>
  
  <p>Could someone please give me a hand?</p>
  
  <p>Thanks</p>