Home > Backend Development > PHP Tutorial > 怎么让mysql每天自动删除和增加一定的记录

怎么让mysql每天自动删除和增加一定的记录

WBOY
Release: 2016-06-23 13:30:12
Original
885 people have browsed it

怎么让mysql在某个表里每天自动删除和增加一定的记录


回复讨论(解决方案)

每天凌晨三点执行

  create event event_call_defer     on schedule every 1 day starts date_add(date(curdate() + 1),interval 3 hour)  on completion preserve enable  do  begin      delete from tbl_name limit 10  end  
Copy after login
Copy after login

每天凌晨三点执行

  create event event_call_defer     on schedule every 1 day starts date_add(date(curdate() + 1),interval 3 hour)  on completion preserve enable  do  begin      delete from tbl_name limit 10  end  
Copy after login
Copy after login

谢谢
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template