Answers for "installing mysql python connector"

14

python install mysql connector

pip3 install mysql-connector-python  #Python 3
pip install mysql-connector-python
Posted by: Guest on June-09-2020
1

how to install mysql python

pip install mysql-connector
Posted by: Guest on March-15-2020
3

mysql python connector

import mysql.connector

mydb = mysql.connector.connect(
  host="localhost",
  user="yourusername",
  password="yourpassword"
)

print(mydb)
Posted by: Guest on July-04-2020
0

mysql connector/python query example

Press CTRL+C to copy import datetime
import mysql.connector

cnx = mysql.connector.connect(user='scott', database='employees')
cursor = cnx.cursor()

query = ("SELECT first_name, last_name, hire_date FROM employees "
         "WHERE hire_date BETWEEN %s AND %s")

hire_start = datetime.date(1999, 1, 1)
hire_end = datetime.date(1999, 12, 31)

cursor.execute(query, (hire_start, hire_end))

for (first_name, last_name, hire_date) in cursor:
  print("{}, {} was hired on {:%d %b %Y}".format(
    last_name, first_name, hire_date))

cursor.close()
cnx.close()
Posted by: Guest on October-05-2020

Code answers related to "installing mysql python connector"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language