title: Python3 Loop Through Array of DBs Then Connect
body: <p>I am trying to loop through a number of mysql hosts which have the same connection info and execute the same query on each of them &amp; fetch the results.</p>
  <p>I'm still learning python &amp; am stuck on the following;</p>
  <pre><code>import pymysql
  
  ENDPOINTS=['endpoint01', 'endpoint02', 'endpoint03', 'endpoint04']
  USER=&quot;SOME_USER&quot;
  PASS=&quot;SOME_PASSWORD&quot;
  
  print(&quot;Testing&quot;)
  
  for x in ENDPOINTS:
    # Open database connection
    DATAB = pymysql.connect(x,USER,PASS)
    cursor = DATAB.cursor()
    cursor.execute(&quot;show databases like 'THIS%'&quot;)
    data = cursor.fetchall()
    print (data)
    DATAB.close()
  </code></pre>
  <p>And this is the error I receive;</p>
  <pre><code>DATAB = pymysql.connect(x,USER,PASS)
  TypeError: __init__() takes 1 positional argument but 4 were given
  </code></pre>