Home >Database >Mysql Tutorial >利用mysql事件调度定时删除binlog_MySQL

利用mysql事件调度定时删除binlog_MySQL

WBOY
WBOYOriginal
2016-06-01 13:10:18887browse

1    开启事件调度器:

      set global event_scheduler = 1;


2    删除10天前的binlog,并设置每天检查:

      create event delete_binlog on schedule every 1 day do purge master logs before date_sub(now(),interval 10 day);


3    查看时间调度器是否生成:

      select * from information_schema.events;


建议在充分测试后使用

Statement:
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