title: Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on
body: <p>So i keep getting this error when trying to connect to my database remotely. The strange thing is it works for like 1/2 query(s) a minute but then after those query's it stops working and gives this error message. This just started happening randomly, before it used to work fine for many querys per second. </p>
  
  <p>Details:</p>
  
  <ul>
  <li>Im using xampp to host my database</li>
  <li>The details to connect to the database are correct</li>
  </ul>
  
  <p>Any ideas what might be happening?</p>
  
  <p>Example of code (This is the code which I using to test the connection):</p>
  
  <pre><code>                $connection = mysql_connect('IP', 'DATABASE PASSWORD', 'PASSWORD', 'DATABSE NAME') or die(mysql_error());
                  if (!$connection) 
                      die('Not connected : ' . mysql_error());
  
                  $db_selected = mysql_select_db('DATABSE NAME', $connection);
                  if (!$db_selected)
                      die ('Can\'t use : ' . mysql_error());
  
                  $string = mysql_query("SELECT * FROM `characters` WHERE `name` LIKE 'gil'") or die(mysql_error());
                  if($result = mysql_fetch_assoc($string))
                      echo $result['name'];
  </code></pre>
  
  <p>Full Error code: </p>
  
  <pre><code>Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'IP' (4) in /vhosts/DOMAIN/httpdocs/test.php on line 1
  Can't connect to MySQL server on 'IP' (4)
  </code></pre>