title: How to prevent Reverse DNS Lookup with PDO-connect per IP-adress?
body: <p>I try to connect via PDO to another database server (MySQL) per IP-adress.</p>
  
  <pre><code>$db = new PDO('mysql:host=IP-ADDRESS;dbname=AAA', 'USER', 'XXXXX');
  </code></pre>
  
  <p>I faked IP-adress and user here, this is not the error ;)</p>
  
  <p>But for whatever reason PDO is going to make some crazy reverse DNS lookups and ends up connecting to a completely different server, which has another IP-adress and other domains assigned per A-records as the reverse dns lookup from PDO will find here.</p>
  
  <p>PDO throws the specific exception:</p>
  
  <pre><code>SQLSTATE[28000] [1045] Access denied for user 'USER'@'WWW.ANOTHER-SERVER.COM'
  </code></pre>
  
  <p>While connecting in the terminal via mysql-client everything is working as expected.</p>
  
  <ol>
  <li>How can i avoid that PDO makes a reverse DNS lookup?</li>
  <li>How can i tell PDO that it should connect per IP-adress given in the parameters?</li>
  <li>How can it be, that this reverse DNS lookup is so wrong? </li>
  </ol>
  
  <p>There are no specific entries in /etc/hosts, which could be the root cause for that.</p>