0% found this document useful (0 votes)
32 views11 pages

Library Management System

The document describes a library management system that allows librarians and users to perform operations like adding books, borrowing/returning books, searching books, user authentication, tracking transactions, calculating fines, and sending notifications. It includes details on the database, user interface, main functionalities, and sample code for the admin and user menus.

Uploaded by

palkisbeevi25
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views11 pages

Library Management System

The document describes a library management system that allows librarians and users to perform operations like adding books, borrowing/returning books, searching books, user authentication, tracking transactions, calculating fines, and sending notifications. It includes details on the database, user interface, main functionalities, and sample code for the admin and user menus.

Uploaded by

palkisbeevi25
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Library Management

System
Database setup: Use SQLite, MySQL, or any other
database system. Define tables for books,
users, transactions, etc.

User Interface:
. Use libraries like Tkinter, PyQt, or
Django for creating the user interface.

Functionalities:

Adding Books: Allow librarians to add books to the system.


Borrowing/Returning Books: Users should be able to borrow and return books.
Searching Books: Implement a search functionality to search for books by
title, author, genre, etc.
User Authentication: Implement login/logout functionality for users and
librarians.
Transaction History: Keep track of all transactions, including borrowing and
returning books.
Fine Calculation: Implement a system to calculate fines for late returns.
Email Notifications: Send email reminders for overdue books or upcoming due
dates.
Admin Panel: Provide an admin panel for librarians to manage the system,
including adding/removing users, managing fines, etc
Program for creating main menu

import Operations
def Adminmenu() :
while True:
print("\t\t\t Admin Menu \n")
print("==============================================================")
print("1. Book Management")
print("2. User Management")
print("3. Admin management")
print("4. User Feedback and Ratings Table")
print("5. Logout ")
print("===============================================================")
choice=int(input("Enter Choice between 1 to 5-------> : "))
if choice==1:
Operations.BookManagement()
elif choice==2:
Operations.UserManagement()
elif choice==3:
Operations.AdminManagement()
elif choice==4:
Operations.FeedbackTable()
elif choice==5:
print("Thanks for visiting our Library:))")
print("Logged out of the system")
break
else:
print("Wrong Choice......Enter Your Choice again")
continue

def Usermenu() :
while True:
print("\t\t\t User Menu \n")
print("==============================================================")
print("1. Book Centre")
print("2. Feedback and Ratings")
print("3. Logout ")
print("===============================================================")
choice=int(input("Enter Choice between 1 to 3-------> : "))
if choice==1:
Operations.BookCentre()
elif choice==2:
Operations.Feedback()
elif choice==3:
print("Thanks for visiting our Library:))")
print("Logged out of the system")
break
else:
print("Wrong Choice......Enter Your Choice again")
continue
import mysql.connector
import Tables
#---------------------------------------------------------------------------------------------------------
def displayAdmin():
print()
print("Admin Records: \n")
mycursor.execute("SELECT * FROM AdminRecord")
records=mycursor.fetchall()
row_no=0
for rows in records :
row_no+=1
print("******************************","Row no.",row_no,"******************************")
print("\t AdminID: ", rows[0])
print("\t Password: ", rows[1])
print()
x=input("Press Enter to continue")
return
#---------------------------------------------------------------------------------------------------------
def insertAdmin():
while True :
data=()
print()
AdminID=input("Enter AdminID: ")
Password=input(" Enter Password to be set: ")
data=(AdminID,Password)
query="INSERT INTO AdminRecord VALUES (%s, %s)"
mycursor.execute(query,data)
mydb.commit()
print()
ch=input("Do you wish to do add more Administrators?[Yes/No] : ")
if ch=="no" or ch=="No" or ch=="NO":
break
return
#---------------------------------------------------------------------------------------------------------
def deleteAdmin():
while True:
print()
AdminID=input(" Enter AdminID whose details to be deleted : ")
mycursor.execute("DELETE from AdminRecord where AdminID={0}".format("\'"+AdminID+"\'"))
mydb.commit()
ch=input("Do you wish to delete more Administrators?[Yes/No] : ")
if ch=="no" or ch=="No" or ch=="NO":
break
return
#---------------------------------------------------------------------------------------------------------
def searchAdmin():
while True:
print()
Search=input(" Enter AdminID to be Searched: ")
mycursor.execute("SELECT * FROM AdminRecord where AdminID={0}".format("\'"+Search+"\'"))
records=mycursor.fetchall()
row_no=0
if records:
for rows in records :
row_no+=1
print("******************************","Searched Admin Record","******************************")
print("\t AdminID: ", rows[0])
print("\t Password: ", rows[1])
print()
else:
print("Search Unsuccesfull")

ch=input("Do you wish to Search more Administrators?[Yes/No] : ")


if ch=="no" or ch=="No" or ch=="NO":
break
return
#---------------------------------------------------------------------------------------------------------
def updateAdmin():
while True:
print()
data=()
AdminID=input(" Enter Admin ID for whose details need to be updated : ")
Password=input(" Enter new Password : ")
query="UPDATE AdminRecord SET Password = %s WHERE AdminID=%s"
data=(Password,AdminID)
mycursor.execute(query,data)
mydb.commit()
ch=input("Do you wish to Search more Administrators?[Yes/No] : ")
if ch=="no" or ch=="No" or ch=="NO":
break
return
#---------------------------------------------------------------------------------------------------------
mydb=mysql.connector.connect(host="localhost",user="root",passwd="mysql123",database="Library")
mycursor=mydb.cursor()
Program for creating the book:
import mysql.connector
import Tables
#----------------------------------------------------------------------------------------
#Admin Operation on Books
def displayBook():
print()
print("Book Records: \n")
mycursor.execute("""SELECT BookRecord.BookID,BookRecord.BookName,BookRecord.Author,BookRecord.Publisher,UserRecord.UserName,UserRecord.UserID
FROM BookRecord
LEFT JOIN UserRecord ON BookRecord.BookID=UserRecord.BookID""")
records=mycursor.fetchall()
row_no=0
for rows in records :
row_no+=1
print("******************************","Row no.",row_no,"******************************")
print("\t BookID: ", rows[0])
print("\t BookName: ", rows[1])
print("\t Author: ", rows[2])
print("\t Publisher: ", rows[3])
print("\t Issued By: ", rows[4])
print("\t His UserID: ", rows[5])
print()
x=input("Press Enter to return to the User Menu")
return
#----------------------------------------------------------------------------------------
def insertBook():
while True :
data=()
print()
BookID=input(" Enter BookID: ")
BookName=input(" Enter Book Name: ")
Author=input(" Enter Author Name: ")
Publisher=input(" Enter Publisher Name: ")
data=(BookID, BookName, Author, Publisher)
query="INSERT INTO BookRecord VALUES (%s, %s, %s, %s)"
mycursor.execute(query,data)
mydb.commit()
print()
ch=input("Do you wish to do add more Books?[Yes/No] : ")
if ch=="no" or ch=="No" or ch=="NO":
break
return

#----------------------------------------------------------------------------------------
def deleteBook():
while True:
print()
BookID=input(" Enter BookID whose details to be deleted : ")
mycursor.execute("DELETE from BookRecord where BookID = {0} ".format("\'"+BookID+"\'"))
mydb.commit()
ch=input("Do you wish to delete more Books?[Yes/No] : ")
if ch=="no" or ch=="No" or ch=="NO":
break
return

#----------------------------------------------------------------------------------------
def searchBook():
while True:
print()
Search=input("Enter BookID to be Searched:")
mycursor.execute("SELECT BookRecord.BookID,BookRecord.BookName,BookRecord.Author,BookRecord.Publisher,UserRecord.UserName,UserRecord.UserID\
FROM BookRecord\
LEFT JOIN UserRecord ON BookRecord.BookID=UserRecord.BookID\
WHERE BookRecord.BookID={0}".format("\'"+Search+"\'"))
records=mycursor.fetchall()
row_no=0
if records:
for rows in records :
row_no+=1
print("******************************","Searched Book Record","******************************")
print("\t BookID: ", rows[0])
print("\t BookName: ", rows[1])
print("\t Author: ", rows[2])
print("\t Publisher: ", rows[3])
print("\t Issued By: ", rows[4])
print("\t His UserID: ", rows[5])
print()
else:
print("Search Unsuccesfull")

ch=input("Do you wish to Search more Books?[Yes/No] : ")


if ch=="no" or ch=="No" or ch=="NO":
break
return

#----------------------------------------------------------------------------------------
def updateBook():
while True:
print()
data=()
BookID=input(" Enter Book ID for whose details need to be updated : ")
BookName=input(" Enter updated Book Name : ")
Author=input(" Enter updated Author Name : ")
Publisher=input(" Enter the updated Publisher Name : ")
query="UPDATE BookRecord SET Bookname = %s, Author = %s, Publisher = %s WHERE BookID = %s"
data=(BookName,Author,Publisher,BookID)
mycursor.execute(query,data)
mydb.commit()
print("Updated succesfully")
ch=input("Do you wish to do Update more Books?[Yes/No] : ")
if ch=="no" or ch=="No" or ch=="NO":
break
return
#----------------------------------------------------------------------------------------
#----------------------------------------------------------------------------------------
#----------------------------------------------------------------------------------------
#User Operation on Books
#User Operation on Books
def BookList():
print()
print("Book Records: \n")
mycursor.execute("""SELECT * from BookRecord""")
records=mycursor.fetchall()
row_no=0
for rows in records :
row_no+=1
print("******************************","Row no.",row_no,"******************************")
print("\t BookID: ", rows[0])
print("\t BookName: ", rows[1])
print("\t Author: ", rows[2])
print("\t Publisher: ", rows[3])
print()
x=input("Press any key to return to the User Menu")
return

def IssueBook():
check=input("Enter your UserID:")
mycursor.execute("Select BookID from UserRecord where UserID={0}".format("\'"+check+"\'"))
checking=mycursor.fetchone()
if checking==(None,):
print()
print("Available Books: \n")
mycursor.execute("""SELECT BookRecord.BookID,BookRecord.BookName, BookRecord.Author,BookRecord.Publisher,UserRecord.UserName,UserRecord.UserID
FROM BookRecord
LEFT JOIN UserRecord ON BookRecord.BookID=UserRecord.BookID""")
records=mycursor.fetchall()
row_no=0
for rows in records:
if rows[5]==None:

row_no+=1
print("******************************","Row no.",row_no,"******************************")
print("\t BookID: ", rows[0])
print("\t BookName: ", rows[1])
print("\t Author: ", rows[2])
print("\t Publisher: ", rows[3])
print()
if row_no==0:
print("Sorry, there are no available books in the Library")
print("Please Wait for some time till someone return the book you want")
x=input("Press any key to return to the User Menu")
return
data=()
UserID=input("Enter yor UserID:")
Issue=input("Enter the BookID available to be issued:")
query="UPDATE UserRecord SET BookID=%s WHERE UserID = %s"
data=(Issue,UserID)
mycursor.execute(query,data)
mydb.commit()
print("Book Successfully Issued")
x=input("Press any key to return to the User Menu")
return
else:
print("Book Already Issued, Kindly Return That first")
x=input("Press any key to return to the User Menu")
return
#----------------------------------------------------------------------------------------
def ShowIssuedBook():
print()
UserID=input("Enter yor UserID:")
mycursor.execute("SELECT UserID, UserName, UserRecord.BookID, BookName\
FROM Library.UserRecord INNER JOIN Library.BookRecord\
ON BookRecord.BookID=UserRecord.BookID\
WHERE UserID={0}".format("\'"+UserID+"\'"))
records=mycursor.fetchall()
row_no=0
if records:
for rows in records :
row_no+=1
print("******************************","Issued Book","******************************")
print("\t UserID: ", rows[0])
print("\t UserName: ", rows[1])
print("\t BookID: ", rows[2])
print("\t BookName: ", rows[3])
print()
x=input("Press any key to return to the User Menu")
return
else:
print("No Book Issued")
x=input("Press Enter to return to the User Menu")
return
#----------------------------------------------------------------------------------------
def returnBook():
print()
data=()
UserID=input("Enter yor UserID:")
Rec=input("Enter BookID to be return:")
query="""UPDATE UserRecord SET BookID = %s WHERE UserID= %s and BookID=%s"""
data=(None,UserID,Rec)
mycursor.execute(query,data)
mydb.commit()
print("Return Successfull")
x=input("Press Enter to return to the User Menu")
return
#----------------------------------------------------------------------------------------

mydb=mysql.connector.connect(host="localhost",user="root",passwd="mysql123",database="Library")
mycursor=mydb.cursor()
Project login.py:
import Book
import User
import Admin
import Tables
import mysql.connector
#----------------------------------------------------------------------------------------
#Operations for Admin Menu

def BookManagement():
while True:
print("\t\t\t Book Record Management\n")
print("==============================================================")
print("1. Add Book Record")
print("2. Display Book Records")
print("3. Search Book Record")
print("4. Delete Book Record")
print("5. Update Book Record")
print("6. Return to Main Menu")
print("===============================================================")
choice=int(input("Enter Choice between 1 to 6-------> : "))
if choice==1:
Book.insertBook()
elif choice==2:
Book.displayBook()
elif choice==3:
Book.searchBook()
elif choice==4:
Book.deleteBook()
elif choice==5:
Book.updateBook()
elif choice==6:
return
else:
print("Wrong Choice......Enter Your Choice again")
x=input("Press Enter to continue")
#----------------------------------------------------------------------------------------
def UserManagement():
while True:
print("\t\t\t User Record Management\n")
print("==============================================================")
print("1. Add User Record")
print("2. Display User Records")
print("3. Search User Record")
print("4. Delete User Record")
print("5. Update User Record")
print("6. Return to Main Menu")
print("===============================================================")
choice=int(input("Enter Choice between 1 to 5-------> : "))
if choice==1:
User.insertUser()
elif choice==2:
User.displayUser()
elif choice==3:
User.searchUser()
elif choice==4:
User.deleteUser()
elif choice==5:
User.updateUser()
elif choice==6:
return
else:
print("Wrong Choice......Enter Your Choice again")
x=input("Press Enter to continue")
#----------------------------------------------------------------------------------------
def AdminManagement():
while True:
print("\t\t\t Admin Record Management\n")
print("==============================================================")
print("1. Add Admin Record")
print("2. Display Admin Records")
print("3. Search Admin Record")
print("4. Delete Admin Record")
print("5. Update Admin Record")
print("6. Return to Main Menu")
print("===============================================================")
choice=int(input("Enter Choice between 1 to 5-------> : "))
if choice==1:
Admin.insertAdmin()
elif choice==2:
Admin.displayAdmin()
elif choice==3:
Admin.searchAdmin()
elif choice==4:
Admin.deleteAdmin()
elif choice==5:
Admin.updateAdmin()
elif choice==6:
return
else:
print("Wrong Choice......Enter Your Choice again")
x=input("Press Enter to continue")

def FeedbackTable():
print()
print("Feeback and Rating Table: \n")
mycursor.execute("SELECT * from Feedback")
records=mycursor.fetchall()
row_no=0
for rows in records :
row_no+=1
print("******************************","Row no.",row_no,"******************************")
print("\t Feedbacks: ", rows[0])
print("\t Rating out of 10: ", rows[1])
print()
#----------------------------------------------------------------------------------------
#----------------------------------------------------------------------------------------
#----------------------------------------------------------------------------------------

# User Menu Operations

def BookCentre():
while True:
print("\t\t\t Book Centre \n")
print("==============================================================")
print("1. List of all Books ")
print("2. Issue Book ")
print("3. Display Issued Book Records ")
print("4. Return Issued Book ")
print("5. Return to Main Menu ")
print("===============================================================")
choice=int(input("Enter Choice between 1 to 4-------> : "))
if choice==1:
Book.BookList()
elif choice==2:
Book.IssueBook()
elif choice==3:
Book.ShowIssuedBook()
elif choice==4:
Book.returnBook()
elif choice==5:
return
else:
print("Wrong Choice......Enter Your Choice again")
x=input("Press Enter to continue")
#----------------------------------------------------------------------------------------
def Feedback():
while True:
data=()
print("\t\t\t Feedback and Rating\n")
print("==============================================================")
Feedback=input("Enter your Review about our Library and tell us how can we improve to make you happy!!:))---->")
Ratings=input("Rate us out of 10:")
data=(Feedback,Ratings)
query="INSERT INTO Feedback VALUES (%s, %s)"
mycursor.execute(query,data)
mydb.commit()
print()
print("Thank you for your valuable Feedback")
return
#----------------------------------------------------------------------------------------
mydb=mysql.connector.connect(host="localhost",user="root",passwd="mysql123",database="Library")
mycursor=mydb.cursor()
Tables.py:
import sys
import MainMenu
import Tables
import mysql.connector
#---------------------------------------------------------------------------------------------------------
def login_to_admin() : # Admin Login
print("\n")
print("| ~~ T H E B O O K W O R M ~~ |")
print()
print(" LOGIN TO YOUR ACCOUNT \n")
print("WARNING : Only three Attempts to login")
for attempts in range(0,3) : # Only three Attempts to login then system will switch off
AdminID=input("\t Enter AdminID : ") #Original Admins:Kunal1020 -->123, Siddesh510 --> 786 ,Vishal305---> 675
password=input("\t Enter Password : ")

print()
mycursor.execute("SELECT Password from AdminRecord where AdminID={0}".format("\'"+AdminID+"\'"))
result=mycursor.fetchone()
if result:
temp,=result #coverting tuple to integer for comparing password
if temp==password: # authenticated usernames and passwords
print("\n\t\t WELCOME {0} to THE BOOK WORM \n ".format("\'"+AdminID+"\'"))
MainMenu.Adminmenu()
break
else :
print("\t INVALID PASSWORD OR USERNAME ! TRY AGAIN ")
print("\t {0}st attempt is over \n ".format(attempts + 1))
continue

else :
print("\t NO SUCH USERNAME ! TRY AGAIN ")
print("\t {0}st attempt is over \n ".format(attempts + 1))
continue

else :
print("\t Try again later \n ")
print("\t System off \n ")
print("*---------------------------------------------------------------------------------* \n")
#---------------------------------------------------------------------------------------------------------
def login_to_user(): #User login

print("\n")
print("| ~~ T H E B O O K W O R M ~~ |")
print()
print("1.CREATE ACCOUNT")
print("2.LOGIN TO YOUR ACCOUNT")
ch=int(input("Enter choice-->"))
if ch==1:
data=()
UserId=input("Enter your UserId ")
UserName=input("Enter your Name ")
Password=input("Enter Password to be set:")
data=(UserId,UserName, Password,None)
query="INSERT INTO UserRecord VALUES (%s, %s,%s,%s)"
mycursor.execute(query,data)
mydb.commit()
mycursor.execute("SELECT UserId from UserRecord where UserId={0}".format("\'"+UserId+"\'"))
result=mycursor.fetchone()
if result:
print("Account successfully created")
else:
print("Account already Exists")
login_to_user()

elif ch==2:
print("WARNING : Only three Attempts to login at a time")
for attempts in range(0,3) : # Only three Attempts to login then system will switch off
UserID=input("\t Enter UserID : ") # Default Users:Kunal- UserID 101 and Passwd 1234,
#Vishal- UserID 102 and Passwd 3050,Siddhesh- UserID 103 and Passwd 5010
password=input("\t Enter Password : ")
print()
mycursor.execute("SELECT Password from UserRecord where UserID={0}".format("\'"+UserID+"\'"))
result=mycursor.fetchone()
if result:
temp,=result #coverting tuple to integer fro comparing password
if temp==password: # authenticated usernames and passwords
print("\n\t\t WELCOME {0} to THE BOOK WORM \n ".format("\'"+UserID+"\'"))
MainMenu.Usermenu()
break
else :
print("\t INVALID PASSWORD OR USERNAME ! TRY AGAIN ")
print("\t {0}st attempt is over \n ".format(attempts + 1))
continue

else :
print("\t NO SUCH USERNAME ! TRY AGAIN ")
print("\t {0}st attempt is over \n ".format(attempts + 1))
continue

else :
print("\t Try again later \n ")
print("\t System off \n ")
print("*---------------------------------------------------------------------------------* \n")
else:
print("Enter valid choice")
login_to_user()
#---------------------------------------------------------------------------------------------------------
def menu() :
print("\n\n")
print("|*************************************************************************************|")
print("| ~~ T H E B O O K W O R M ~~ |")
print("|*************************************************************************************|")
print("\n")
print(" ======================= MENU ======================= \n")
print(" 1. Login as a ADMIN")
print(" 2. Login as a USER")
print(" 3. EXIT \n\n ") #exit

while True :
ch= input(" Select [ 1/2/3 ] : ")
print()
if ch== "1" :
login_to_admin()
break
elif ch== "2" :
login_to_user()
break
elif ch== "3" :
cancel_request = input(" DO YOU WISH TO EXIT... [yes/no ] : ")
if cancel_request in ["yes","Yes","YES"] :
sys.exit()
break
else :
print(" INVALID COMMAND ")
print(" RETRY \n")
continue
#---------------------------------------------------------------------------------------------------------
mydb=mysql.connector.connect(host="localhost",user="root",passwd="mysql123",database="Library")
mycursor=mydb.cursor()

menu()
User. Py:
import mysql.connector
import Tables

#--------------------------------------------------------------------------------------------------------------------------------
def displayUser():
print()
print("User Records: \n")
mycursor.execute("""SELECT UserRecord.UserID,UserRecord.UserName,UserRecord.Password,BookRecord.BookName,BookRecord.BookID
FROM UserRecord
LEFT JOIN BookRecord ON UserRecord.BookID=BookRecord.BookID""")
records=mycursor.fetchall()
row_no=0
for rows in records :
row_no+=1
print("******************************","Row no.",row_no,"******************************")
print("\t UserID: ", rows[0])
print("\t UserName: ", rows[1])
print("\t Password: ", rows[2])
print("\t Book Issued: ", rows[3])
print("\t Its BookID: ", rows[4])
print()
x=input("Press any key to return to the User Menu")
return
#--------------------------------------------------------------------------------------------------------------------------------
def insertUser():
while True :
data=()
print()
UserID=input(" Enter UserID: ")
UserName=input(" Enter User Name: ")
Password=input(" Enter Password to be Set: ")
data=(UserID, UserName, Password,None)
query="INSERT INTO UserRecord VALUES (%s, %s, %s,%s)"
mycursor.execute(query,data)
mydb.commit()
print()
ch=input("Do you wish to do add more Users?[Yes/No] : ")
if ch=="no" or ch=="No" or ch=="NO":
break
return
#--------------------------------------------------------------------------------------------------------------------------------
def deleteUser():
while True:
print()
UserID=input(" Enter UserID whose details to be deleted : ")
mycursor.execute("DELETE from UserRecord where UserID = {0} ".format("\'"+UserID+"\'"))
mydb.commit()
ch=input("Do you wish to delete more Users?[Yes/No] : ")
if ch=="no" or ch=="No" or ch=="NO":
break
return
#--------------------------------------------------------------------------------------------------------------------------------
def searchUser():
while True:
print()
Search=input(" Enter UserID to be Searched: ")
mycursor.execute("SELECT UserID, UserName, Password , BookName, UserRecord.BookID\
FROM Library.UserRecord LEFT JOIN Library.BookRecord\
ON BookRecord.BookID=UserRecord.BookID\
WHERE UserRecord.UserID={0}".format("\'"+Search+"\'"))
records=mycursor.fetchall()
row_no=0
if records:
for rows in records :
row_no+=1
print("******************************","Searched User Record","******************************")
print("\t UserID: ", rows[0])
print("\t UserName: ", rows[1])
print("\t Password: ", rows[2])
print("\t Book Issued: ", rows[3])
print("\t Its BookID: ", rows[4])
print()
else:
print("Search Unsuccesfull")

ch=input("Do you wish to Search more Users?[Yes/No] : ")


if ch=="no" or ch=="No" or ch=="NO":
break
return
#--------------------------------------------------------------------------------------------------------------------------------
def updateUser():
while True:
print()
data=()
UserID=input(" Enter User ID for whose details need to be updated : ")
UserName=input(" Enter Updated User Name : ")
Password=input(" Enter Updated Password : ")
query="UPDATE UserRecord SET Username = %s, Password = %s WHERE UserID=%s"
data=(UserName,Password,UserID)
mycursor.execute(query,data)
mydb.commit()
print("Updated succesfully")
ch=input("Do you wish to Update more Users?[Yes/No] : ")
if ch=="no" or ch=="No" or ch=="NO":
break
return
#--------------------------------------------------------------------------------------------------------------------------------
mydb=mysql.connector.connect(host="localhost",user="root",passwd="mysql123",database="Library")
mycursor=mydb.cursor()
Output:

You might also like