title: Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock'
body: <p>When running <code>rake db:migrate</code>, I get this error:</p>
  
  <pre><code>Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
  </code></pre>
  
  <hr>
  
  <p>I've looked at other people's questions on here and none of their solutions have helped me, for example:</p>
  
  <p><strong>Solution One</strong></p>
  
  <pre><code>mysql.server start
  </code></pre>
  
  <p>returns: </p>
  
  <pre><code>Starting MySQL
  </code></pre>
  
  <p>. ERROR! The server quit without updating PID file (/usr/local/var/mysql/something.pid).</p>
  
  <p><strong>Solution Two</strong></p>
  
  <pre><code>mysqladmin variables | grep socket
  </code></pre>
  
  <p>returns:</p>
  
  <pre><code>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!
  </code></pre>
  
  <hr>
  
  <p><strong>Further notes:</strong>
  I tried reinstalling mysql using homebrew, which was successful, and I'm still receiving the same errors:</p>
  
  <pre><code>Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
  </code></pre>