Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. import mysql.connector
  2.  
  3. mydb = mysql.connector.connect(
  4.   host="localhost",
  5.   user="yourusername",
  6.   passwd="yourpassword",
  7.   database="mydatabase"
  8. )
  9.  
  10. mycursor = mydb.cursor()
  11.  
  12. sql = "INSERT INTO customers (name, address) VALUES (%s, %s)"
  13. val = ("John", "Highway 21")
  14. mycursor.execute(sql, val)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement