在Windows中将MySQL与Python集成,需要遵循以下步骤:
pip install mysql-connector-python
import mysql.connector
cnx = mysql.connector.connect(
host="localhost",
user="your_username",
password="your_password",
database="your_database"
)
cursor = cnx.cursor()
query = "SELECT * FROM your_table"
cursor.execute(query)
for row in cursor:
print(row)
cursor.close()
cnx.close()
这样,就可以在Windows中将MySQL与Python集成。推荐的腾讯云相关产品和产品介绍链接地址:
领取专属 10元无门槛券
手把手带您无忧上云