| 解決 之道 問(wèn)題描述:在mysql的gameshop數(shù)據(jù)庫(kù)上操作刪除語(yǔ)句,數(shù)據(jù)庫(kù)一直在執(zhí)行,響應(yīng)完后,報(bào)Lock wait timeout exceeded;try restarting transaction; 執(zhí)行delete語(yǔ)句刪除失敗。 原因:有會(huì)話(huà)執(zhí)行過(guò)DML操作,然后沒(méi)commit提交,再執(zhí)行刪除操作,就鎖了。 __________________________________________________________________________ Lock wait timeout exceeded; try restarting transaction一些信息 1、鎖等待超時(shí)。是當(dāng)前事務(wù)在等待其它事務(wù)釋放鎖資源造成的??梢哉页鲦i資源競(jìng)爭(zhēng)的表和語(yǔ)句,優(yōu)化你的SQL,創(chuàng)建索引等,如果還是不行,可以適當(dāng)減少并發(fā)線程數(shù)。 2、你的事務(wù)在等待給某個(gè)表加鎖時(shí)超時(shí)了,估計(jì)是表正被另的進(jìn)程鎖住一直沒(méi)有釋放。 3、搜索解決 之道 4、 InnoDB會(huì)自動(dòng)的檢測(cè)死鎖進(jìn)行回滾,或者終止死鎖的情況。 引用 InnoDB automatically detects transaction deadlocks and rolls back a transaction or transactions to break the deadlock. InnoDB tries to pick small transactions to roll back, where the size of a transaction is determined by the number of rows inserted, updated, or deleted. 
 | 
|  | 
來(lái)自: 為什么圖書(shū)館13 > 《待分類(lèi)》