# -*- coding: UTF-8 -*- import pymysql class change_expiretime(object): def change_expiretime(self,bc_ip): db=pymysql.connect(bc_ip,"unadba","1223Bc@2008","unary",port=3306,charset='utf8') cursor=db.cursor() try: sql_set_expire = "SET SQL_SAFE_UPDATES = 0;update unary.tbl_user set etime = 33145650867 where state=1;" cursor.execute(sql_set_expire) db.commit() print("update success") except: print("update error") db.close()