Update mysql table every twenty four hours automatically

前端 未结 2 1361
栀梦
栀梦 2021-01-22 20:41

I was wondering how I could set up a script (I\'m assuming it would be a cron job) that would reset a field in a mysql table every twenty four hours back to zero. I would want i

2条回答
  •  一个人的身影
    2021-01-22 21:03

    create a python script that connects to the mysql table and performs the update query.

    Create a cron job that runs 1 time every day that executes:

    python updateValue.py

    It is quite easy, and the best way I can think of doing it.

    The crontab argument would look like:

    0 0 * * * python updateValue.py
    

提交回复
热议问题