Python Mysql

import MySQLdb

# 打开数据库连接
db = MySQLdb.connect("localhost","testuser","test123","TESTDB" )

# 使用cursor()方法获取操作游标 
cursor = db.cursor() #cursor用来执行命令的方法:
原文地址:https://www.cnblogs.com/chengxuyuandashu/p/3719433.html