mysql 死锁 Deadlock found when trying to get lock; try restarting transaction
出现这个原因要记住一点就是:innodb的行锁和解锁都是针对主键索引的。如果查询时根据索引锁表,但更新时却不是通过主键更新,那么等待的解锁查询的进程将会报1213错误,程序里有可能返回一个null值实例:tablesoldgoods(表名)soldgoodsID索引productidbusinessid开启线程A执行:setautocommit=0;selectbusinessidfromsold