python和mysql连接数据库的问题
程序员文章站
2024-02-08 09:40:34
...
mysqlpythonmysqldb
import mysql.connectorcnx = mysql.connector.connect(user='scott', password='tiger',host='127.0.0.1',database='employees')cnx.close()方法二:import MySQLdbdb = MySQLdb.connect(host="localhost", # your host, usually localhost user="john", # your username passwd="megajonhy", # your password db="jonhydb") # name of the data basecur = db.cursor() cur.execute("SELECT * FROM YOUR_TABLE_NAME")
请问各位老师这个mysqlconnector 和MySQLdb有什么区别?谢谢各位老师
上一篇: vmware安装有关问题
下一篇: php的抽象概念有哪些