About MySQLdb conn.autocommit(True)

by default MySQLdb autocommit is false,

You can set autocommit to True in your MySQLdb connection like this,

conn=MySQLdb.connect(host="localhost",user="root",passwd="mysql",db="dang",charset="utf8")
conn.get_autocommit()        #will return **False**
conn.autocommit(True)
conn.get_autocommit()        #Should return **True** now
cursor = conn.cursor()

Leave a Comment