title: Remote MySQL Connection Issues - Lost connection to MySQL server (110)
body: <p>I'm trying to access a MySQL database on server X from a php script on server Y.  Both are dedicated cPanel servers that I have root access to.  Here's what I've tried:</p>
  
  <ol>
  <li>On server X I put the IP address of server Y in the "Additional MySQL Access Hosts" feature of WHM.</li>
  <li>On server X I logged into the cPanel for the account hosting the database I'm trying to connect to and I entered server Y's IP on the "Remote Database Access Hosts" page.</li>
  <li>On server X I whitelisted server Y's IP in the firewall and opened incoming/outgoing port 3306 TCP.</li>
  <li>On server X I added server Y's IP address to the /etc/hosts.allow file</li>
  </ol>
  
  <p>Despite all of these things I've tried, whenever I try to run the script on server Y I get the timeout message:</p>
  
  <pre><code>Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 110
  </code></pre>
  
  <p>This is my PHP code:</p>
  
  <pre><code>$host = '123.456.789.0'; //server X's IP
  $db = 'user_test';
  $user = 'user_test';
  $pass = 'password';
  
  if(mysql_connect($host, $user, $pass)){
      mysql_select_db($db);
  }
  else die(mysql_error());
  </code></pre>
  
  <p>Thanks!</p>