title: MySQL connection not working: 2002 No such file or directory
body: <p>I'm trying to set up WordPress. I have Apache and MySQL running, and the accounts and database are all set up. I tried to make a simple connection:</p>
  
  <pre><code>&lt;?php
      $conn = mysql_connect('localhost', 'USER', 'PASSWORD');
      if(!$conn) {
          echo 'Error: ' . mysql_errno() . ' - ' . mysql_error();
      }
  ?&gt;
  </code></pre>
  
  <p>And I always get this:</p>
  
  <blockquote>
    <p>Error: 2002 - No such file or
    directory</p>
  </blockquote>
  
  <p>What file or directory could it be talking about?</p>
  
  <p>I'm on a OS X Snow Leopard, using the built-in Apache. I installed MySQL using the x86_64 dmg.</p>
  
  <p>UPDATE: I found that the socket is at /tmp/mysql.sock, so In php.ini, I replaced all occurrences of the wrong path with that.</p>