Mysql报Deadlock found when trying to get lock; try restarting transaction问题解决!!
事务1 begin; 事务2begin;
select * from a where id = 1 for update;
select * from a where id = 2 for update;
select * from a where id = 2 for update; lock wait 锁等待
select * from a where id = 1 for update; ( 执行完就i报:Deadlock found when trying to get lock; try restarting transaction)
这个时候事务2 被干掉了,只剩下了事务1
select * from information_schema.INNODB_TRX
trx_mysql_thread_id
kill 进程ID
原文链接:https://blog.csdn.net/qq_44240587/article/details/108400666