Update mysql table every twenty four hours automatically

前端 未结 2 1360
栀梦
栀梦 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 20:58

    What about using the MySql event scheduler itself?

    http://dev.mysql.com/doc/refman/5.6/en/events-overview.html

    0 讨论(0)
  • 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
    
    0 讨论(0)
提交回复
热议问题