title: mysql cli to 127.0.0.1 but redirect to 172.17.0.1
body: <p>I have installed mysql-client in my Mac by the following command:</p>
  
  <pre><code>brew install mysql-client
  </code></pre>
  
  <p>And when I run the following command: </p>
  
  <pre><code>mysql -h 127.0.0.1 -u root -p 
  </code></pre>
  
  <p>An ERROR 1045 occured:</p>
  
  <p><code>ERROR 1045 (28000): Access denied for user 'root'@'172.17.0.1' (using password: NO)</code></p>
  
  <p>but when I use <code>Sequel Pro</code> I can login the local mysql server.</p>
  
  <p>Why the 127.0.0.1 becomes 172.17.0.1 ？</p>
  
  <hr>
  
  <h3>MORE DETAIL INFO</h3>
  
  <p>I run this command on local host iTerm. I use the docker pull to pull a mysql:5.7 image from docker registry: </p>
  
  <p><code>docker run --name mysql -e MYSQL_ROOT_PASSWORD=xxxxxx -d -p 0.0.0.0:3306:3306 mysql:5.7</code></p>
  
  <p>And the mysql container is just running, then I use <strong>Sequel Pro</strong> GUI client to connect into the database in docker, and it works. And then I try to use </p>
  
  <p><code>brew install mysql-client</code> </p>
  
  <p>to install the mysql command (because I want to use it to run a sql file to prepare data for my project's tests suite). after installed mysql-client, i use the command</p>
  
  <p><code>mysql -h 127.0.0.1 -u root -p</code> </p>
  
  <p>try to connect database, but it promote the </p>
  
  <p><code>**ERROR 1045 (28000): Access denied for user 'root'@'172.17.0.1'</code> (using password: NO)**. </p>
  
  <p>I did <strong>not</strong> do any configuration for the mysql docker container.</p>