pip mysql-connector-python code example
Example 1: python install mysql connector
pip3 install mysql-connector-python #Python 3
pip install mysql-connector-python
Example 2: mysql python connector
import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="yourusername",
password="yourpassword"
)
print(mydb)