mysql - Set a cron job to delete a specific database table table every midnight

admin2025-01-07  3

my name is frank, i have been trying to create a cronjob that will be deleting a database table every 12 midnight but i found no help, below is the database table. please any help?

DELETE FROM X51g_myCRED_log WHERE ref = 'link_click'

my name is frank, i have been trying to create a cronjob that will be deleting a database table every 12 midnight but i found no help, below is the database table. please any help?

DELETE FROM X51g_myCRED_log WHERE ref = 'link_click'
Share Improve this question asked Oct 16, 2020 at 6:57 Onyeka FranklinOnyeka Franklin 1
Add a comment  | 

1 Answer 1

Reset to default 0

The sql command for dropping a table would be something like:

DROP TABLE IF EXISTS X51g_myCRED_log

That would drop (delete) the table 'X51g_myCRED_log'.

You can accomplish this with WP CLI:

wp db query "DROP TABLE IF EXISTS X51g_myCRED_log".

Be careful, I havent tested this, but this should point you in the right direction

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736257450a439.html

最新回复(0)