一个 client 下:
session a:select * from car where id=1 for update
session b:select * from car where id=2 for update
另外一个 client 下:
session a:select * from car where id=2 for update
session b:select * from car where id=1 for update
如此上述场景就会导致死锁,可以根据 innodb_lock_waits、innodb_locks 等查询具体是那些 sql 导致,具体分析下。