Mysql报Deadlock found when trying to get lock; try restarting transaction问题解决 问题发生场景 今天记录一下最近项目中遇到的一个问题,前几天在部署项目后,在线上运行过程中,突然报了入下这样的错误,从报错信息中我们可以看到,是mysql在执行update操作的时候报了一个死锁的问题,今天解决了,特此记录一下. 在这...
问题描述报错信息很简单在执行update操作语句的时候报错。Deadlock found when trying to get lock; try restarting transaction; nested exception is com.MySQL.cj.jdbc.exceptions.MySQLTransactionRollbackException: Deadlock found when trying to get lock;MySQL锁介绍MySQL有三种锁的级别:页级、表级、...
出现错误 Deadlock found when trying to get lock; try restarting transaction。然后通过网上查找资料,重要看到有用信息了。 错误图片如下: 2 解决方案 由于mysql执行delete操作时WHERE 中字段使用了非主键,然而那个表有在进行其它操作时,就会出现这个错了。所以只要删除时使用主键作为条件即可。
Mysql报Deadlock found when trying to get lock; try restarting transaction问题解决 问题发生场景 今天记录一下最近项目中遇到的一个问题,前几天在部署项目后,在线上运行过程中,突然报了入下这样的错误,从报错信息中我们可以看到,是mysql在执行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 ...
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 ...