Caused by: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction

153392398 RUNNING 2023-08-23 09:10:09 6 397413 0 2 4 1136 2 2 0 REPEATABLE READ 1 1 0 0 0 0
328854561014064 RUNNING 2023-08-23 09:19:03 0 397493 0 0 0 1136 0 0 0 REPEATABLE READ 1 1 0 0 0 0
328854560997800 RUNNING 2023-08-23 09:06:41 0 397338 0 0 0 1136 0 0 0 REPEATABLE READ 1 1 0 0 0 0

解決方案
1.首先執行這條sql,找到對應的trx_mysql_thread_id字段
SELECT * FROM information_schema.INNODB_TRX;

2.再執行這條sql,查看有無數據
select * from performance_schema.data_locks;

3.如果上面兩張表有數據
執行kill trx_mysql_thread_id,重新執行2中的sql,若是查不到數據 說明就可以了。
至于具體原因以及原理 后續再了解,暫時解決這個報錯

浙公網安備 33010602011771號