After the mysql innodb row lock is unlocked, the result is 1213 dead, like Deadlock found when. To solve this problem, remember that innodb row locks and locks are for primary key indexes. If the table is locked Based on the index during the query, but it is not updated through the primary key during the update, the process waiting to unlock the query will report a 1213 error, and a null value instance may be returned in the program: table soldgoods (table Name) soldgoodsID index productid businessid enable thread A execution: set autocommit = 0; select businessid from soldgoods where soldgoodsID = 'hangzhou' for UPDATE; run thread B on the query result: set autocommit = 0; select businessid from soldgoods where soldgoodsID = 'hangzhou' for UPDATE; run updat in thread A when the query is waiting to be unlocked. E soldgoods set productid = 2 where businessid = 'taobao' is not used to update the lock Table value based on the primary key. Thread B will appear: [Err] 1213-Deadlock found when trying to get lock; try restarting transaction if you change the statement executed in the last thread A: update soldgoods set productid = 2 where soldgoodsID = 'ac63837c76222e4a5419e2529d775ae4 'based on the index modification value, then commit. Thread B can get the query value smoothly.