title: MySQL Error 2002 - Can't connect through socket '/tmp/mysql.sock' on 64-bit, with a botched 32-bit uninstall complicating things
body: <p>I'm new to Macs/MySQL, and am struggling to get MySQL working. I'm on 64-bit Lion, and first attempted to install the 32-bit MySQL from the command line. I then attempted to remove it and replace it with the 64-bit DMG, but the results of mysql -V indicate the 32-bit may still be around in some form. I get 2002 errors when trying to run MySQL-related commands, but Python's MySQLdb works fine. Below is more information; please let me know how to get this working. </p>
  
  <p>I'm aware that some sort of linking is usually used to resolve the problem, but I can't find an answer that fits my file structure. I will try to be very responsive to asks for more information. Thanks!</p>
  
  <pre><code>bash-3.2$ mysql -V
  mysql  Ver 14.14 Distrib 5.1.62, for apple-darwin10.3.0 (i386) using readline 5.1
  
  bash-3.2$ mysql
  ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
  
  bash-3.2$ mysqld
  120501 20:21:42 [Warning] Can't create test file /usr/local/mysql-5.1.62-osx10.6-x86_64/data/MDP-main.lower-test
  120501 20:21:42 [Warning] Can't create test file /usr/local/mysql-5.1.62-osx10.6-x86_64/data/MDP-main.lower-test
  mysqld: Can't change dir to '/usr/local/mysql-5.1.62-osx10.6-x86_64/data/' (Errcode: 13)
  120501 20:21:42 [ERROR] Aborting
  120501 20:21:42 [Note] mysqld: Shutdown complete
  
  
  bash-3.2$ ls /usr/local
  MySQL-python-1.2.3              mysql
  bin                             mysql-5.1.62-osx10.6-x86_64
  etc                             share
  git
  </code></pre>
  
  <p>And my bash path:</p>
  
  <pre><code>PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql-5.1.62-osx10.6-x86_64/bin      
  export PATH
  </code></pre>
  
  <hr>
  
  <p>Edit 1: In response to the "permissions" suggestion, it doesn't seem to work in current form:</p>
  
  <pre><code>bash-3.2$ chown -R mysql.mysql /usr/local/mysql
  chown: mysql.mysql: Invalid argument
  </code></pre>
  
  <p>In that directory:</p>
  
  <pre><code>bash-3.2$ ls -a /usr/local/mysql
  .               README          include         scripts
  ..              bin             lib             share
  COPYING         data            man             sql-bench
  INSTALL-BINARY  docs            mysql-test      support-files
  </code></pre>