There is a cell in the timestamp in the table, which contains the date when it is necessary to update this entry (for example, change the status). Can MySQL do it automatically?

    1 answer 1

    CREATE EVENT update_status ON SCHEDULE EVERY 1 MINUTE COMMENT 'Update Status from 1 to 2 after 1 week.' DO UPDATE `table` SET `status` = 2 WHERE creation_datetime < CURRENT_TIMESTAMP - INTERVAL 1 WEEK AND `status` = 1; 

    !!! Do not forget to make sure that the scheduler is not disabled, and enable it if it is not running:

     SET GLOBAL event_scheduler = ON; 

    But it is better to adjust the startup line and / or the configuration file. See more here and here .