{"id":200504,"date":"2025-05-06T12:10:59","date_gmt":"2025-05-06T04:10:59","guid":{"rendered":"https:\/\/server.hk\/cnblog\/200504\/"},"modified":"2025-05-06T12:10:59","modified_gmt":"2025-05-06T04:10:59","slug":"%e5%a6%82%e4%bd%95%e9%ab%98%e6%95%88%e5%9c%b0%e4%bf%ae%e6%94%b9%e5%a4%9a%e4%b8%aa%e6%95%b0%e6%8d%ae%e5%ba%93%e4%b8%ad%e5%90%8c%e5%90%8d%e8%a1%a8%e7%9a%84%e6%95%b0%e6%8d%ae%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/200504\/","title":{"rendered":"## \u5982\u4f55\u9ad8\u6548\u5730\u4fee\u6539\u591a\u4e2a\u6570\u636e\u5e93\u4e2d\u540c\u540d\u8868\u7684\u6570\u636e\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>## \u5982\u4f55\u9ad8\u6548\u5730\u4fee\u6539\u591a\u4e2a\u6570\u636e\u5e93\u4e2d\u540c\u540d\u8868\u7684\u6570\u636e\uff1f<\/h1>\n<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241106\/1730903438672b7d8ea306d.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>\u540c\u65f6\u4fee\u6539\u591a\u4e2a\u6570\u636e\u5e93\u4e2d\u540c\u540d\u8868\u7684\u6280\u5de7<\/strong><\/p>\n<p>\u4f60\u6709\u5927\u7ea6 60 \u4e2a\u6570\u636e\u5e93\uff0c\u6bcf\u4e2a\u6570\u636e\u5e93\u4e2d\u6709\u4e00\u5f20\u540c\u540d\u7684\u8868\uff0c\u9700\u8981\u5bf9\u6240\u6709\u6570\u636e\u5e93\u4e2d\u7684\u8fd9\u5f20\u8868\u8fdb\u884c\u589e\u5220\u6539\u67e5\u3002\u5982\u4f55\u5b9e\u73b0\u6b64\u64cd\u4f5c\uff1f<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><\/p>\n<p>\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6b65\u9aa4\u6765\u5b9e\u73b0\uff1a<\/p>\n<p><strong>1. \u67e5\u770b\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u8868\uff1a<\/strong><\/p>\n<pre>select * from information_schema.`tables` where table_name = 'undo_log';<\/pre>\n<p><strong>2. \u4f7f\u7528\u5faa\u73af\u8fde\u63a5\u5230\u6bcf\u4e2a\u6570\u636e\u5e93\u5e76\u64cd\u4f5c\u8868\uff1a<\/strong><\/p>\n<pre>for i in range(60):\n    # \u6839\u636e\u5faa\u73af\u7d22\u5f15\u683c\u5f0f\u5316\u6570\u636e\u5e93\u540d\u79f0\n    db_name = 'db' + str(i)\n\n    # \u8fde\u63a5\u5230\u6570\u636e\u5e93\n    connection = mysql.connector.connect(\n        host='localhost',\n        user='root',\n        password='password',\n        database=db_name\n    )\n\n    # \u521b\u5efa\u6e38\u6807\n    cursor = connection.cursor()\n\n    # \u6267\u884c\u64cd\u4f5c\uff08\u4f8b\u5982\u66f4\u65b0\u6216\u5220\u9664\uff09\n    cursor.execute(\"UPDATE undo_log SET message='Updated message' WHERE id=1\")\n\n    # \u63d0\u4ea4\u66f4\u6539\n    connection.commit()\n\n    # \u5173\u95ed\u8fde\u63a5\n    cursor.close()\n    connection.close()<\/pre>\n<p><strong>\u6ce8\u610f\uff1a<\/strong><\/p>\n<ul>\n<li>\u786e\u4fdd\u5177\u6709\u8bbf\u95ee\u6240\u6709\u6570\u636e\u5e93\u7684\u6743\u9650\u3002<\/li>\n<li>\u6839\u636e\u4f60\u7684\u7279\u5b9a\u9700\u6c42\u8c03\u6574 sql \u64cd\u4f5c\u3002<\/li>\n<li>\u8fd9\u53ea\u662f\u4e00\u4e2a\u793a\u4f8b\u4ee3\u7801\uff0c\u4f60\u9700\u8981\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u8fdb\u884c\u8c03\u6574\u3002<\/li>\n<\/ul>\n<p>\u7ec8\u4e8e\u4ecb\u7ecd\u5b8c\u5566\uff01\u5c0f\u4f19\u4f34\u4eec\uff0c\u8fd9\u7bc7\u5173\u4e8e\u300a## \u5982\u4f55\u9ad8\u6548\u5730\u4fee\u6539\u591a\u4e2a\u6570\u636e\u5e93\u4e2d\u540c\u540d\u8868\u7684\u6570\u636e\uff1f\u300b\u7684\u4ecb\u7ecd\u5e94\u8be5\u8ba9\u4f60\u6536\u83b7\u591a\u591a\u4e86\u5427\uff01\u6b22\u8fce\u5927\u5bb6\u6536\u85cf\u6216\u5206\u4eab\u7ed9\u66f4\u591a\u9700\u8981\u5b66\u4e60\u7684\u670b\u53cb\u5427~\u4e3b\u673a\u5b9d\u8d1d\u516c\u4f17\u53f7\u4e5f\u4f1a\u53d1\u5e03\u6570\u636e\u5e93\u76f8\u5173\u77e5\u8bc6\uff0c\u5feb\u6765\u5173\u6ce8\u5427\uff01<\/p>\n<dl>\n<dt>\n <\/dt>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>## \u5982\u4f55\u9ad8\u6548\u5730\u4fee\u6539\u591a\u4e2a\u6570\u636e\u5e93\u4e2d&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-200504","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200504","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=200504"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200504\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=200504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=200504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=200504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}