summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sql1.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/sql1.py b/sql1.py
new file mode 100644
index 0000000..0f3f778
--- /dev/null
+++ b/sql1.py
@@ -0,0 +1,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) \ No newline at end of file