Read MYSQL Table data from Python Code
First we need to import mysql module
Create connection to MySql Database and fetch the records.
Complete code given below-
import mysql.connector
from mysql import connector
conn = mysql.connector.connect(host='127.0.0.1',database='firstschema',user='root',password='2511')
cursor=conn.cursor()
cursor.execute('SELECT * from firstschema.check1')
values=cursor.fetchall()
print(values)
Comments
Post a Comment