mysql定时删除当前时间前分钟的数据 2013-01-31 0个评论 作者:上官车月 收藏 我要投稿 mysql定时删除当前时间前分钟的数据 Sql代码 www.2cto.com SET GLOBAL event_scheduler = ON; delimiter $$ drop event if exists e_wom_stat; create event e_wom_stat on schedule EVERY 1 day
所报的错误为:pymysql.err.OperationalError: (1213, 'Deadlock found when trying to get lock; try restarting transaction') 产生这个问题的原因: 多个线程同时执行,且是先删除后插入,因为删除获取一种锁,插入获取一种锁,而这两种锁都没有解锁,就会冲突,导致报错,注意并不是所有的先删除后插入都会报错,具体参考: https://blog.csdn.net/weixin_34049948/artic
一.查看下自己的MySQL是否开启了binlog日志 # 是否启用binlog日志 OFF:关闭 ON:开启 show variables like 'log_bin'; 二.开启binlog日志 在linxu服务器中找到my.cnf : mysql --help | grep 'Default options' -A 1 执行结果 Default options are read from the following files in the given order: /etc/my.cnf