ITPub博客

首页 > 数据库 > MySQL > python连接mysql数据库

python连接mysql数据库

原创 MySQL 作者:pathfinder_cui 时间:2015-10-19 17:19:49 0 删除 编辑
#!/usr/bin/env python
#encoding=utf-8
import MySQLdb
try:
conn=MySQLdb.connect(host="192.168.8.7",user="root",passwd="xx",db="test")
cur=conn.cursor()
cur=execute("SET autocommit=0")
cur=execute("CALL sp_rollback_demo")
cur.execute("COMMIT")
except Exception,e:
cur.execute("ROLLBACK")
print e

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29620572/viewspace-1815006/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: mysql主从复制
请登录后发表评论 登录
全部评论

注册时间:2014-04-21

  • 博文量
    55
  • 访问量
    70872