title: Failed to Connect to MySQL at localhost:3306 with user root
body: <p>I use Mysql Workbench to connect my database,[<img src="https://i.stack.imgur.com/3QtVL.png" alt="Hostname Port and Username are as shown in figure ,and password is right[1]"></p>
  
  <p>Hostname Port and Username are as shown in figure ,and password is right.When I click Test Connection ,it show as above.But if i use 3307 in place of 3306 as port,it connect sucessfully. What matter lead that and how I fix it? </p>
  
  <p>I use macbook pro and I don't know check which my.cnf. I use sudo vim /usr/local/mysql/my.cnf in terminal .<br>
  And the my.cnf is as below: </p>
  
  <pre><code>[mysqld] 
   sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES            
  </code></pre>
  
  <p>And I rewite it as below:     </p>
  
  <pre><code>[client]
  port=3306
  socket=/tmp/mysql.sock
  
  [mysqld]
  port=3306
  socket=/tmp/mysql.sock
  key_buffer_size=16M
  max_allowed_packet=8M 
  [mysqldump]
  quick 
  </code></pre>
  
  <p>But it does not work.     </p>