Django处理mysql表删除行后id自增的问题。

Posted on 2021-03-29 17:07  风行天下-2080  阅读(822)  评论(0编辑  收藏  举报

1、

https://blog.csdn.net/yangxiaodong88/article/details/80607579

2、在view.py文件中使用truncate

def software(request):
    db = MySQLdb.connect("10.116.xx.xx", "root", "xxxxxxpassword", "xxxxxdatabase", charset="utf8")
    cursor = db.cursor()
    cursor.execute("select version()")
    data=cursor.fetchone()
    cursor.execute("truncate table  app01_softlist")
    print("database version : %s"%data)


 

Copyright © 2024 风行天下-2080
Powered by .NET 8.0 on Kubernetes