[SOLVED] Is there anyway to remove a row in mysql automatically? Nodejs, my-sql

Issue

In mongodb with mongoose we can remove data automatically like this:
expiresAt:{
type: Date,
default: Date.now(),
index: {
expireAfterSeconds: 500,
},
},

But in mysql I cant find any solution for this. Please help.

Solution

you can use the Event Scheduler to start a query every secs,mins,…. if

you have a timestamp

see: https://dev.mysql.com/doc/refman/5.7/en/event-scheduler.html

Answered By – Bernd Buffen

Answer Checked By – Marilyn (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *