I would like to purge my SQL database from all entires older than 1 week, and I\'d like to do it nightly. So, I\'m going to set up a cron job. How do I query mySQL without h
Try creating a shell script like the one below:
#!/bin/bash mysql --user=[username] --password=[password] --database=[db name] --execute="DELETE FROM tbl_message WHERE DATEDIFF( NOW( ) , timestamp ) >=7"
You can then add this to the cron