{"id":252,"date":"2023-02-24T06:09:51","date_gmt":"2023-02-23T22:09:51","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=252"},"modified":"2023-04-30T15:19:09","modified_gmt":"2023-04-30T07:19:09","slug":"how-to-modify-lock-record-timeout-waiting-time-in-mysql","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/24\/how-to-modify-lock-record-timeout-waiting-time-in-mysql\/","title":{"rendered":"MySQL\u600e\u4e48\u4fee\u6539\u9501\u8bb0\u5f55\u8d85\u65f6\u7b49\u5f85\u65f6\u95f4"},"content":{"rendered":"<p>MySQL\u6570\u636e\u5e93\u8d85\u65f6\u7b49\u5f85\u65f6\u95f4\u8fc7\u957f\uff0c\u4e00\u4e2a\u4e8b\u52a1\u7b49\u5f85\u65f6\u95f4\u8fc7\u957f\u4f1a\u9020\u6210\u6b7b\u9501\uff0c\u7279\u5b9a\u573a\u5408\u4e0b\u6709\u5fc5\u8981\u4fee\u6539\u9ed8\u8ba4\u7b49\u5f85\u65f6\u95f4<\/p>\n<p>\uff081\uff09\u767b\u5f55MySQL\uff0c\u67e5\u770b\u9501\u8bb0\u5f55\u7b49\u5f85\u65f6\u95f4\uff1a<\/p>\n<pre><code class=\"language-sql\">SHOW VARIABLES LIKE &#039;innodb_lock_wait_timeout&#039;;<\/code><\/pre>\n<p><!-- more --><\/p>\n<p>\u7b49\u5f85\u65f6\u95f4\u662f50\u79d2<\/p>\n<p>\uff082\uff09\u628a\u8868\u4e2did=1\u7684\u6570\u636e\u52a0\u9501\uff0c\u53e6\u4e00\u4e2a\u4e8b\u52a1\u5bf9\u8bb0\u5f55\u4fee\u6539\uff1a<\/p>\n<pre><code class=\"language-sql\">SELECT * FROM test WHERE id=1 FOR UPDATE;<\/code><\/pre>\n<p>\uff083\uff09\u53e6\u4e00\u4e2a\u7528\u6237\u767b\u5f55mysql\uff0c\u4fee\u6539id=1\u7684\u6570\u636e\uff1a<\/p>\n<pre><code class=\"language-sql\">UPDATE test SET city=&#039;\u676d\u5dde&#039; WHERE id=1;<\/code><\/pre>\n<p>\u8d85\u65f6\u9000\u51fa 1min<\/p>\n<p>\uff084\uff09\u628a\u8d85\u65f6\u7b49\u5f85\u65f6\u95f4\u4fee\u6539\u4e3a5\u79d2\uff1a<\/p>\n<pre><code class=\"language-sql\">SET innodb_lock_wait_timeout=5;<\/code><\/pre>\n<p>\uff085\uff09\u67e5\u770b\u9501\u8bb0\u5f55\u8d85\u65f6\u7b49\u5f85\u65f6\u95f4\uff1a<\/p>\n<pre><code class=\"language-sql\">SHOW VARIABLES LIKE &#039;innodb_lock_wait_timeout&#039;;<\/code><\/pre>\n<p>\uff086\uff09\u53e6\u4e00\u4e2a\u7528\u6237\u4fee\u6539id=1\u7684\u6570\u636e\uff1a<\/p>\n<pre><code class=\"language-sql\">UPDATE test SET city=&#039;\u676d\u5dde&#039; WHERE id=1;<\/code><\/pre>\n<p>\u7b49\u5f85\u65f6\u95f4 7s<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL\u6570\u636e\u5e93\u8d85\u65f6\u7b49\u5f85\u65f6\u95f4\u8fc7\u957f\uff0c\u4e00\u4e2a\u4e8b\u52a1\u7b49\u5f85\u65f6\u95f4\u8fc7\u957f\u4f1a\u9020\u6210\u6b7b\u9501\uff0c\u7279\u5b9a\u573a\u5408\u4e0b\u6709\u5fc5\u8981\u4fee\u6539\u9ed8\u8ba4\u7b49\u5f85\u65f6\u95f4 \uff081\uff09\u767b\u5f55 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-252","post","type-post","status-publish","format-standard","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/252","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=252"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/252\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=252"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}