Lecture @ Database Connectivity between MySQL & Python
Lecture @ Database Connectivity between MySQL & Python
MySQL
(Python -MySQL Connector)
Step-1: Install Python + pip
Step-2: Install MySQL
Step-3: Python <> MySQL Using MySQL Connector
Python Download & Installation:
Open web browser and type the url: www.python.org
Click the download menu and download latest version of
python.
After download complete then double click to install the
python.
Go to MySQL Workbench
Open IDLE
Type import mysql.connector in IDLE then Enter successfully
install mysql-connector
Example-1: Create a Program to check a database connection
is Establish
Create a python file (like db1.py)
To write the program like this
Program:
import mysql.connector
conn=mysql.connector.connect(host='localhost', database='sisiradb',
password='Mother#1', user='root');
if conn.is_connected():
print("Connection Established...")