diff options
-rw-r--r-- | sql1.py | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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 |