title: python mysql.connector module uses wrong IP address
body: <p>I am having an issue when using python mysql.connector module in a script. When I run to connect to a docker container running mysql v8 from my script it tries to connect to the wrong IP address. Below is the sample function:</p>
  
  <pre><code>import mysql.connector
  def connect():
      db =  mysql.connector.connect(
          host="172.17.0.2",
          user="user",
          passwd="password",
          auth_plugin='mysql_native_password')
  </code></pre>
  
  <p>When this is ran, the following error is produced:
  mysql.connector.errors.ProgrammingError: 1045 (28000): Access denied for user 'user'@'172.17.0.1' (using password: YES)</p>
  
  <p>Here is the IP of the docker container that I am trying to connect to</p>
  
  <p>IPAddress": "172.17.0.2"</p>
  
  <p>What really makes this interesting is that I can connect to the database just fine with the mysql.connector when using in an interactive python session. See below</p>
  
  <pre><code>Python 3.7.2 (default, Jan 16 2019, 19:49:22) 
  [GCC 8.2.1 20181215 (Red Hat 8.2.1-6)] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  &gt;&gt;&gt; import mysql.connector
  &gt;&gt;&gt; db =  mysql.connector.connect(
  ... host="172.17.0.2",
  ... user="user",
  ... passwd="passwd",
  ... auth_plugin='mysql_native_password')
  &gt;&gt;&gt; mycursor =  db.cursor()
  &gt;&gt;&gt; mycursor.execute("show databases")
  &gt;&gt;&gt; for x in mycursor: print(x)
  ... 
  ('food',)
  ('information_schema',) 
  </code></pre>
  
  <p>Here is the version of mysql-connector that I am running on Fedora 29</p>
  
  <pre><code>pip list |grep mysql-connector
  mysql-connector-python 8.0.15       
  </code></pre>
  
  <p>Here is docker version info as well</p>
  
  <pre><code>Client:
   Version:           18.09.2
   API version:       1.39
   Go version:        go1.10.6
   Git commit:        6247962
   Built:             Sun Feb 10 04:13:54 2019
   OS/Arch:           linux/amd64
   Experimental:      false
  
  Server: Docker Engine - Community
   Engine:
    Version:          18.09.2
    API version:      1.39 (minimum version 1.12)
    Go version:       go1.10.6
    Git commit:       6247962
    Built:            Sun Feb 10 03:47:25 2019
    OS/Arch:          linux/amd64
    Experimental:     false
  </code></pre>
  
  <p>Any thoughts on what would cause running this from a script to fail?</p>