Firstly, if you really want to delete records older than 30 days, use INTERVAL 30 DAY , instead, when you use INTERVAL 1 MONTH , you will delete records added on Mars on the 31st when it is April 1st.
In addition, your date column is of type int , and DATE_SUB () will return a date in this format YYYY-MM-DD HH:MM:SS , so they are not comparable. You can do this to get around this problem:
DELETE FROM my_news WHERE date < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 30 DAY))
source share