title: Remote Server SQLSTATE[HY000] [2002] Connection timed out
body: <p>When using php to connect to a remote MySQL database (say <code>999.999.999.999</code>) from a server running on a different IP (say <code>888.888.888.888</code>), I get this error: </p>
  
  <blockquote>
    <p>SQLSTATE[HY000] [2002] Connection timed out</p>
  </blockquote>
  
  <p>Here is what I've tried or looked into:</p>
  
  <ul>
  <li>On the remote server, I have allowed connections from the "local server" (<code>888.888.888.88</code>), but that hasn't helped.</li>
  <li>Some answers suggest changing the connection details from <code>localhost</code> to <code>127.0.0.1</code>, but this is not relevant to me as we are connecting to a remote database.</li>
  <li>I restarted the server (CentOS with <code>cPanel</code>) several times with no luck. </li>
  </ul>
  
  <p>Any idea? </p>