fork download
  1. #!/usr/bin/python
  2.  
  3.  
  4. import mysql.connector
  5.  
  6. mydb = mysql.connector.connect(
  7. host="localhost",
  8. user="myusername",
  9. password="mypassword"
  10. )
  11.  
  12. mycursor = mydb.cursor()
  13.  
  14. mycursor.execute("SHOW DATABASES")
  15.  
  16. for x in mycursor:
  17. print(x)
  18. print(type(mycursor))
  19.  
Success #stdin #stdout 0.03s 25904KB
stdin
Standard input is empty
stdout

import mysql.connector

mydb = mysql.connector.connect(
  host="localhost",
  user="myusername",
  password="mypassword"
)

mycursor = mydb.cursor()

mycursor.execute("SHOW DATABASES")

for x in mycursor:
  print(x)
print(type(mycursor))