title: Can't Connect to Local Mysql from terminal
body: <p>NOTE: The full discussion to the answer in this question is in a chat link in the comment section below, above the submitted answers.</p>
  
  <p>The summarized answer is in checked answer. </p>
  
  <p>After meddling with installing the gem for mysql2 and successfully doing that I type </p>
  
  <pre><code>which mysql
  </code></pre>
  
  <p>and it returns</p>
  
  <pre><code>mysql: aliased to nocorrect mysql
  </code></pre>
  
  <p>I'm not sure what this means.</p>
  
  <p>Then I type in </p>
  
  <pre><code> mysql --version
  </code></pre>
  
  <p>and it outputs</p>
  
  <pre><code> mysql  Ver 14.14 Distrib 5.5.20, for osx10.7 (i386) using readline 5.1
  </code></pre>
  
  <p>So I know mysql is installed.</p>
  
  <p>Finally I want to configure a database for my rails app so, from within the correct directory I type:</p>
  
  <pre><code> mysql -u root -p 
  </code></pre>
  
  <p>It asks me for a password and, since there is none, I leave it blank. It outputs this:</p>
  
  <pre><code> ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
  </code></pre>
  
  <p>I've been reading around for a solution but I don't understand any of them. Like finding a file called my.cnf or a folder called etc within the rails framework files... </p>