summaryrefslogtreecommitdiffstats
path: root/sql1.py
blob: 0f3f778de3eaa43956cc1690604990215c202950 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# pip install mysql-connector-python

import mysql.connector

mydb = mysql.connector.connect(
  host="localhost",
  user="root",
  password="foobar",
  database="employees"
)

mycursor = mydb.cursor()
mycursor.execute("SHOW TABLES")
myresult = mycursor.fetchall()
for x in myresult:
  print(x)