title: Can't connect to local MySQL server through socket '/tmp/mysql.sock
body: <p>When I attempted to connect to a local MySQL server during my test suite, it
  fails with the error:</p>
  
  <pre><code>OperationalError: (2002, "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)")
  </code></pre>
  
  <p>However, I'm able to at all times, connect to MySQL by running the command line
  <code>mysql</code> program. A <code>ps aux | grep mysql</code> shows the server is running, and
  <code>stat /tmp/mysql.sock</code> confirm that the socket exists. Further, if I open a
  debugger in <code>except</code> clause of that exception, I'm able to reliably connect
  with the exact same parameters.</p>
  
  <p>This issue reproduces fairly reliably, however it doesn't appear to be 100%,
  because every once in a blue moon, my test suite does in fact run without
  hitting this error. When I attempted to run with <code>sudo dtruss</code> it did not reproduce.</p>
  
  <p>All the client code is in Python, though I can't figure how that'd be relevant.</p>
  
  <p>Switching to use host <code>127.0.0.1</code> produces the error:</p>
  
  <pre><code>DatabaseError: Can't connect to MySQL server on '127.0.0.1' (61)
  </code></pre>