python mysql verileri liste olarak çekme

import mysql.connector

config = {
    'host': 'localhost',
    'user': 'your_username',
    'password': 'your_password',
    'database': 'your_database'
}

cnx = mysql.connector.connect(**config)
cursor = cnx.cursor()

query = "SELECT * FROM your_table"
cursor.execute(query)

result = cursor.fetchall()

cursor.close()
cnx.close()

print(result)

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *