HOME/Articles/

mysql example consult (snippet)

Article Outline

Python mysql example 'consult'

Modules used in program:

  • import mysql.connector

python consult

Python mysql example: consult

import mysql.connector 

dbname = (
  local = "localhost",
  user = "root",
  passwd= "YourPass",
  database="YourDataBase"
)

mycursor = dbname.cursor()

myscursor.execute("SHOW TABLES")

for consult in mycursor:
  print(dbname)