title: Mountain Lion: Can't connect to local MySQL server through socket '/tmp/mysql.sock'
body: <p>I installed mysql via homebrew. I ran the two commands brew suggests:</p>
  
  <pre><code>unset TMPDIR
  
  mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
  </code></pre>
  
  <p>When I tried to run the mysql_secure_installation script, I receive this error:</p>
  
  <pre><code>ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
  </code></pre>
  
  <p>A separate thread led me to believe it had to do with permissions: <a href="https://stackoverflow.com/questions/6525917/connect-to-local-mysql-server-through-socket">connect to local MySQL server through socket</a></p>
  
  <p>I ran the suggested commands substituting their mysql directory with</p>
  
  <pre><code>/usr/local/var/mysql
  </code></pre>
  
  <p>Yet, the problem persists. Help!</p>