# 导入MySQL import pymysql # 连接数据库 conn = pymysql.connect(host="111.111.111.111", user="11111", password="1111111", port=3306, db="11111",charset="utf8") # 创建游标 cursor = conn.cursor() """根据last_sync_time字段更新数据为“2020-8-30 23:35:23”""" # 语法为:" update 表名 set 字段 = ‘ 要更改的数据‘" sql = "update t_car_detail_city set last_sync_time = ‘2020-8-30 23:35:23‘" # 执行sql语句 cursor.execute(sql) # 提交操作 conn.commit() cursor.close() # 关闭游标 conn.close() # 关闭连接