title: Connect to MySQL v8+ (Docker CE) using MySQL a v5.7 MySQL client (Ubuntu)?
body: <p>I'm trying to run a MySQL database in a Docker container and connect to it from the host machine. What I do is:</p>
  
  <p>installing MySQL on Ubuntu host:</p>
  
  <pre><code>sudo apt-get update
  sudo apt-get install mysql-server
  mysql_secure_installation
  </code></pre>
  
  <p>The version is 5.7.11, I then install Docker CE as described <a href="https://docs.docker.com/install/linux/docker-ce/ubuntu/" rel="nofollow noreferrer">here</a>. To run my MySQL and get the IP server I do:</p>
  
  <pre><code>docker run --detach --name=test-mysql --env="MYSQL_ROOT_PASSWORD=password" mysql
  docker inspect test-mysql | grep IPAddress
  </code></pre>
  
  <p>I then try to connect to the MySQL database with:</p>
  
  <pre><code>mysql -uroot -ppassword -h 172.17.0.2 -P 3306
  </code></pre>
  
  <p>And is greeted by the following:</p>
  
  <pre><code>ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be 
  loaded: /usr/lib/mysql/plugin/caching_sha2_password.so: cannot open shared 
  object file: No such file or directory
  </code></pre>
  
  <p>I've understood that there has been <a href="https://mysqlserverteam.com/mysql-8-0-4-new-default-authentication-plugin-caching_sha2_password/" rel="nofollow noreferrer">changes to MySQL Authentication</a>. It's for 8.0.4 and the version on the <a href="https://docs.docker.com/samples/library/mysql/" rel="nofollow noreferrer">Docker image for MySQL</a> seems to be 8.0.11, so I believe it's relevant. </p>
  
  <p>I realise that I can run an earlier version of the MySQL image as so, for example:</p>
  
  <pre><code>docker run --detach --name=test-mysql --env="MYSQL_ROOT_PASSWORD=password" mysql:5
  </code></pre>
  
  <p>Indeed this will let me log on to the Docker Container's MySQL. I suspect I could also install a newer MySQL version, as <a href="https://www.digitalocean.com/community/tutorials/how-to-install-the-latest-mysql-on-ubuntu-16-04" rel="nofollow noreferrer">described here</a>.</p>
  
  <p>But I'd like to understand what the problem is and I'm not sure I actually have the option to switch versions around. So my questions are:</p>
  
  <ul>
  <li>Why can't I log on is it the older MySQL version which does not support the new authentication protocol?</li>
  <li>Is it possible to log on to the Docker container using this combination by changing some configuration?</li>
  </ul>