CRUD Operation in MySQL using Python
#Installing MySQL on Python :
!pip install pymysql
!pip install mysqlclient1) Database Connection :
import mysql.connector
# Establishing connection with the SQL
dataBase = mysql.connector.connect(
host ="localhost",
user ="root",
password ="sahil123",
auth_plugin='mysql_native_password',
port=3306
)
# Cursor to the database
cursor = dataBase.cursor()
cursor.execute("CREATE DATABASE Student")
print("Student Data base is created") 2) Creating Database Table :
3) INSERT Operation :
4) INSERT Multiple Operations:
5) SELECT QUERY:
6) Update Operation :
7) DELETE OPERATION :
8) DROP TABLE:
Last updated