DBMS Exp11
DBMS Exp11
Data Science
Academic Year: 2024-25 Name of Student: Abhishek Sali
Semester: IV Student ID: 23107058
Class / Branch: CSE (Data Science) Date of Performance: 01-04-2025
Subject:DBMS Date of Submission: 01-04-2025
Name of Instructor: Prof. Vaibhav Y
Code:
sudo apt-get install mysql-server
sudo apt-get install python-dev libmysqlclient-dev sudo apt-
get install python-mysqldb sudo apt-get update
sudo apt-get install python3-dev libmysqlclient-dev sudo apt
install python3-pip sudo service mysql restart
import pymysql
print("Connection successful!")
except pymysql.MySQLError as e:
print("MySQL Error: {}".format(e)) # More specific error message
finally:
# Close the connection if it was established if
connection:
connection.close() print("Connection
closed.")
output:
Output:
Conclusion:
Thus, we have understood the concepts of database connectivity with python using CRUD
operations.