Can't use mysql commands in terminal OS X
<p>I can't really understand how to handle with MySQL from terminal. I need to check and change password, and hostname but even simple commands fail except <code>mysql --version</code> </p>

<p>I tried </p>

<pre><code>$   sudo mysql -u root -p
</code></pre>

<p>and also:</p>

<pre><code>$ PATH=${PATH}:/usr/local/mysql/bin.
</code></pre>

<p>Get this error</p>

<pre><code>Access denied for user 'root'@'localhost' (using password: YES)
</code></pre>

<p>or </p>

<pre><code>$   sudo sh -c 'echo /usr/local/mysql/bin &gt; /etc/paths.d/mysql'
$   mysql
</code></pre>

<p>In this case:</p>

<pre><code>ERROR 1045 (28000): Access denied for user 'Robert'@'localhost' (using password: NO)
</code></pre>

<p>What is wrong? What is the right way to handle with MySQL? OS X 10.11</p>

<p>The password is right. However I tried to change it like in the last answer here superuser.com/questions/123275/… but received error :</p>

<pre><code> `Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)` 
</code></pre>

<p>How to fix it?</p>