1. python 安装 MySQLdb 模块 对MySQl进行操作
创建MySQL连接
conn = MySQLdb.connect(host="", user="", passwd="", db="", charset="utf8") // 创建连接
cursor = conn.cursor() // 创建指针
# insert
sql = "insert into tableName values (%s, %s)"
param = ('one', 'two')
cursor.execute(sql, param)
conn.commit() // 一定要commit 否则会很郁闷的 数据库里的id会自增 但不会有数据 作者就遇到过此问题 @_@~