title: Tried every thing still getting ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in mac
body: <p>Every time I run XAMPP and try to run <code>$mysql -u root -p</code>, its throwing me an error which is:</p>
  <blockquote>
  <p>ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)</p>
  </blockquote>
  <p>I am using XAMPP version 1.7.3 in Mac OS-10.9. Starting Apache and MySQL is not a problem and I have confirmed Apache has started by going to activity monitor.</p>
  <p>Few things I tried:</p>
  <ol>
  <li><p>checked if MySQL is running by typing this command in terminal: <code>mysqladmin -u root -p status</code>. Result was:</p>
  <blockquote>
  <p>mysqladmin: connect to server at 'localhost' failed
  error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
  Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!</p>
  </blockquote>
  </li>
  <li><p>I checked and found mysql.sock file in <code>/var/mysql/mysql.sock</code>.</p>
  </li>
  </ol>
  <p>Things that could have triggered this error but cant say what is wrong:</p>
  <ol>
  <li>I recently upgraded my OS to Mavericks from Mountain Lion.</li>
  <li>I had also installed separate MySQL to work with Ruby on Rails. I have made sure that version is off.</li>
  </ol>
  <p>Without fixing this problem I am not able to do any development locally and connecting MySQL in PHP script seems impossible. So any help will be appreciated.</p>
  <p>Here is error_log file from <code>/applications/xampp/xamppfiles/logs/error_log</code>:</p>
  <pre><code>[Sat Nov 02 09:56:31 2013] [notice] caught SIGTERM, shutting down
  [Sat Nov 02 09:56:39 2013] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
  [Sat Nov 02 09:56:40 2013] [notice] Digest: generating secret for digest authentication ...
  [Sat Nov 02 09:56:40 2013] [notice] Digest: done
  [Sat Nov 02 09:56:40 2013] [notice] Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
  [Sat Nov 02 12:55:47 2013] [notice] caught SIGTERM, shutting down
  [Sat Nov 02 13:40:16 2013] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
  [Sat Nov 02 13:40:18 2013] [notice] Digest: generating secret for digest authentication ...
  [Sat Nov 02 13:40:18 2013] [notice] Digest: done
  [Sat Nov 02 13:40:18 2013] [notice] Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
  [Sat Nov 02 15:12:39 2013] [notice] caught SIGTERM, shutting down
  [Sat Nov 02 20:54:41 2013] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
  [Sat Nov 02 20:54:43 2013] [notice] Digest: generating secret for digest authentication ...
  [Sat Nov 02 20:54:43 2013] [notice] Digest: done
  [Sat Nov 02 20:54:44 2013] [notice] Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
  [Sat Nov 02 21:10:53 2013] [notice] caught SIGTERM, shutting down
  [Sat Nov 02 21:10:57 2013] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
  [Sat Nov 02 21:10:58 2013] [notice] Digest: generating secret for digest authentication ...
  [Sat Nov 02 21:10:58 2013] [notice] Digest: done
  [Sat Nov 02 21:10:58 2013] [notice] Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
  [Sat Nov 02 21:31:39 2013] [notice] caught SIGTERM, shutting down
  [Sat Nov 02 21:31:44 2013] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
  [Sat Nov 02 21:31:47 2013] [notice] Digest: generating secret for digest authentication ...
  [Sat Nov 02 21:31:47 2013] [notice] Digest: done
  [Sat Nov 02 21:31:47 2013] [notice] Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
  [Sat Nov 02 21:45:07 2013] [notice] caught SIGTERM, shutting down
  [Sun Nov 03 08:50:06 2013] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
  [Sun Nov 03 08:50:09 2013] [notice] Digest: generating secret for digest authentication ...
  [Sun Nov 03 08:50:09 2013] [notice] Digest: done
  [Sun Nov 03 08:50:10 2013] [notice] Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations  
  
     
  </code></pre>