用户1
begin;
select * from table where id = 1 for update;
用户2
update table set ... where id = 1;
用户2就一直在等待, 能不能让用户2快速失败, 直接报错啊
用户1
begin;
select * from table where id = 1 for update;
用户2
update table set ... where id = 1;
用户2就一直在等待, 能不能让用户2快速失败, 直接报错啊
3 回答1.4k 阅读✓ 已解决
4 回答292 阅读
6 回答597 阅读✓ 已解决
2 回答627 阅读✓ 已解决
1 回答675 阅读✓ 已解决
3 回答363 阅读✓ 已解决
2 回答328 阅读✓ 已解决
设置一个超时时间为10s
修改my.cnf
在[mysqld]下面加入:
则10s后收到如下错误:(mysql默认50s)