[go: up one dir, main page]

0% found this document useful (0 votes)
12 views1 page

Connection Python

The document contains Python code to connect to a MySQL database using the mysql.connector library. It checks if the connection is successful and prints a confirmation message. Additionally, there is a commented-out section that includes a command to create a database named 'Studentdatabase' if it does not already exist.

Uploaded by

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

Connection Python

The document contains Python code to connect to a MySQL database using the mysql.connector library. It checks if the connection is successful and prints a confirmation message. Additionally, there is a commented-out section that includes a command to create a database named 'Studentdatabase' if it does not already exist.

Uploaded by

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

import mysql.

connector

con = mysql.connector.connect(host="localhost",user="root",password="Server@123",)

if con.is_connected():

print("Successfully connected to MySQL Database")

'''

mycursor = con.cursor()

mycursor.execute("CREATE DATABASE IF NOT EXISTS Studentdatabase;")

'''

You might also like