MySQL -- Lock wait timeout exceeded; try restarting transaction参数控制
生活随笔
收集整理的這篇文章主要介紹了
MySQL -- Lock wait timeout exceeded; try restarting transaction参数控制
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Lock wait timeout exceeded; try restarting transaction
鎖等待超時。。回滾事務。。
?
?
當事務1 ?獲得鎖?
start TRANSACTION?
update user set ?username='gh3g' where id=2;#獲得鎖
?
此時 事務2 ?開始事務
start TRANSACTION?
update user set ?username='m3mm' where id=2;
此時 過一段時間 就好報一個 鎖等待錯誤
Lock wait timeout exceeded; try restarting transaction
?
?
那么這段時間 是由哪個參數控制的呢。。。。
參數如下
innodb_lock_wait_timeout=50
表示 鎖等待時間50秒。。。50秒內無法獲得鎖 就會產生錯誤
Lock wait timeout exceeded; try restarting transaction
?
總結
以上是生活随笔為你收集整理的MySQL -- Lock wait timeout exceeded; try restarting transaction参数控制的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 关于MySQL出现锁等待lock wai
- 下一篇: MySQL数据库优化实战