title: Your connection attempt failed for user 'root' to the MySQL server at localhost:3306 but succeed in terminal
body: <h2>Solved after restart</h2>
  
  <p>I was trying to connect to localhost on mysql workbench and got this message:</p>
  
  <blockquote>
    <p>Your connection attempt failed for user 'root' to the MySQL server at
    localhost:3306:   Unable to connect to localhost:3306</p>
    
    <p>Please: 1 Check that MySQL is running on address localhost 2 Check
    that MySQL is reachable on port 3306 (note: 3306 is the default, but
    this can be changed) 3 Check the user root has rights to connect to
    localhost from your address (MySQL rights define what clients can
    connect to the server and from which machines)  4 Make sure you are
    both providing a password if needed and using the correct password for
    localhost connecting from the host address you're connecting from</p>
  </blockquote>
  
  <p>However, when I tried on terminal, the connection was successful:</p>
  
  <pre><code>$ mysql -u root -p -h localhost -P 3306
  Enter password: 
  Welcome to the MySQL monitor.  Commands end with ; or \g.
  Your MySQL connection id is 13
  Server version: 8.0.19 MySQL Community Server - GPL
  
  Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
  
  Oracle is a registered trademark of Oracle Corporation and/or its
  affiliates. Other names may be trademarks of their respective
  owners.
  
  Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  
  mysql&gt; quit
  </code></pre>
  
  <p>Was there a problem of my workbench configuration or something?</p>