How to use python and SQL
Python makes SQL more easy to use any manage tables or data in a structured manner.
How to use SQL with python?
Step1: install mysql-connector.
pip install mysql-connector-python
Step2: create connection (create a folder with .py extension)
import mysql.connector
mydatabase = mysql.connector.connect(
host="localhost",
user="your username",
password="your password"
)
print(mydatabase)
mydatabase = mysql.connector.connect(
host="localhost",
user="your username",
password="your password"
)
print(mydatabase)
Comments
Post a Comment