{"id":7410,"date":"2024-11-14T08:42:22","date_gmt":"2024-11-14T00:42:22","guid":{"rendered":"https:\/\/fwq.ai\/blog\/7410\/"},"modified":"2024-11-14T08:42:22","modified_gmt":"2024-11-14T00:42:22","slug":"%e5%a6%82%e4%bd%95%e5%ae%9e%e6%97%b6%e6%89%93%e5%8d%b0-shell-%e8%84%9a%e6%9c%ac%e4%b8%ad%e7%9a%84-mysql-%e6%9f%a5%e8%af%a2%e7%bb%93%e6%9e%9c%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/7410\/","title":{"rendered":"\u5982\u4f55\u5b9e\u65f6\u6253\u5370 Shell \u811a\u672c\u4e2d\u7684 MySQL \u67e5\u8be2\u7ed3\u679c\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173079882382649.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u5b9e\u65f6\u6253\u5370 Shell \u811a\u672c\u4e2d\u7684 MySQL \u67e5\u8be2\u7ed3\u679c\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u5b9e\u65f6\u6253\u5370 Shell \u811a\u672c\u4e2d\u7684 MySQL \u67e5\u8be2\u7ed3\u679c\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5728 shell \u811a\u672c\u4e2d\u5b9e\u65f6\u6253\u5370  \u67e5\u8be2\u7ed3\u679c<\/strong><\/p>\n<p>\u4e3a\u4e86\u5728\u4f7f\u7528 shell \u811a\u672c\u8fdb\u884c\u6570\u636e\u5e93\u8dd1\u5e93\u65f6\u5b9e\u65f6\u6253\u5370 sql \u67e5\u8be2\u7ed3\u679c\uff0c\u53ef\u4ee5\u5229\u7528 mysql \u7684 -v \u6807\u5fd7\u3002<\/p>\n<p>\u5728 mysql \u547d\u4ee4\u4e2d\u6dfb\u52a0 -v \u53c2\u6570\uff0c\u53ef\u4ee5\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\uff0c\u5c06\u67e5\u8be2\u6267\u884c\u8fc7\u7a0b\u4e2d\u7684\u8be6\u7ec6\u4fe1\u606f\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u4e2d\u3002\u4f8b\u5982\uff1a<\/p>\n<pre>mysql -v -h$mysqlhost -uroot -p$rootpwd -p$mysqlport -e \"sql \u8bed\u53e5\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6b64\u65f6\uff0c\u67e5\u8be2\u6267\u884c\u8fc7\u7a0b\u4e2d\u7684\u8fdb\u5ea6\u4fe1\u606f\u3001\u8b66\u544a\u548c\u9519\u8bef\u7b49\u90fd\u4f1a\u5b9e\u65f6\u6253\u5370\u51fa\u6765\u3002<\/p>\n<p>\u53e6\u4e00\u79cd\u65b9\u6cd5\u662f\u5c06 sql \u8bed\u53e5\u91cd\u5b9a\u5411\u5230\u4e00\u4e2a\u6587\u4ef6\u4e2d\uff0c\u7136\u540e\u4f7f\u7528 tl \u547d\u4ee4\u5b9e\u65f6\u76d1\u89c6\u8be5\u6587\u4ef6\u7684\u53d8\u5316\u3002\u4f8b\u5982\uff1a<\/p>\n<pre>mysql -h$mysqlhost -uroot -p$rootpwd -P$mysqlport -e \"sql \u8bed\u53e5\" &gt; result.log\ntail -f result.log<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>tail -f \u547d\u4ee4\u4f1a\u4e0d\u65ad\u76d1\u89c6 result.log \u6587\u4ef6\u7684\u672b\u5c3e\uff0c\u5e76\u5b9e\u65f6\u5c06\u65b0\u6dfb\u52a0\u7684\u5185\u5bb9\u6253\u5370\u51fa\u6765\uff0c\u4ece\u800c\u8fbe\u5230\u5b9e\u65f6\u6253\u5370\u67e5\u8be2\u7ed3\u679c\u7684\u6548\u679c\u3002<\/p>\n<p>\u4f46\u662f\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0ctail \u547d\u4ee4\u53ef\u80fd\u4f1a\u5b58\u5728\u4e00\u5b9a\u7684\u5ef6\u8fdf\uff0c\u56e0\u6b64\u5b9e\u65f6\u6253\u5370\u53ef\u80fd\u4f1a\u5b58\u5728\u8f7b\u5fae\u7684\u5361\u987f\u73b0\u8c61\u3002\u5efa\u8bae\u7ed3\u5408\u5b9e\u9645\u60c5\u51b5\u9009\u62e9\u6700\u5408\u9002\u7684\u65b9\u6cd5\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5b9e\u65f6\u6253\u5370 Shell \u811a\u672c\u4e2d\u7684 MySQL \u67e5\u8be2\u7ed3\u679c\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 shell \u811a\u672c\u4e2d\u5b9e\u65f6\u6253\u5370 \u67e5\u8be2\u7ed3\u679c \u4e3a\u4e86\u5728\u4f7f\u7528 shell \u811a\u672c\u8fdb\u884c\u6570\u636e\u5e93\u8dd1\u5e93\u65f6\u5b9e\u65f6\u6253\u5370 sql \u67e5\u8be2\u7ed3\u679c\uff0c\u53ef\u4ee5\u5229\u7528 mysql \u7684 -v \u6807\u5fd7\u3002 \u5728 mysql \u547d\u4ee4\u4e2d\u6dfb\u52a0 -v \u53c2\u6570\uff0c\u53ef\u4ee5\u542f\u7528\u8be6\u7ec6\u6a21\u5f0f\uff0c\u5c06\u67e5\u8be2\u6267\u884c\u8fc7\u7a0b\u4e2d\u7684\u8be6\u7ec6\u4fe1\u606f\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u4e2d\u3002\u4f8b\u5982\uff1a mysql -v -h$mysqlhost -uroot -p$rootpwd -p$mysqlport -e &#8220;sql \u8bed\u53e5&#8221; \u767b\u5f55\u540e\u590d\u5236 \u6b64\u65f6\uff0c\u67e5\u8be2\u6267\u884c\u8fc7\u7a0b\u4e2d\u7684\u8fdb\u5ea6\u4fe1\u606f\u3001\u8b66\u544a\u548c\u9519\u8bef\u7b49\u90fd\u4f1a\u5b9e\u65f6\u6253\u5370\u51fa\u6765\u3002 \u53e6\u4e00\u79cd\u65b9\u6cd5\u662f\u5c06 sql \u8bed\u53e5\u91cd\u5b9a\u5411\u5230\u4e00\u4e2a\u6587\u4ef6\u4e2d\uff0c\u7136\u540e\u4f7f\u7528 tl \u547d\u4ee4\u5b9e\u65f6\u76d1\u89c6\u8be5\u6587\u4ef6\u7684\u53d8\u5316\u3002\u4f8b\u5982\uff1a mysql -h$mysqlhost -uroot -p$rootpwd -P$mysqlport -e &#8220;sql \u8bed\u53e5&#8221; &gt; result.log tail -f result.log \u767b\u5f55\u540e\u590d\u5236 tail -f \u547d\u4ee4\u4f1a\u4e0d\u65ad\u76d1\u89c6 result.log \u6587\u4ef6\u7684\u672b\u5c3e\uff0c\u5e76\u5b9e\u65f6\u5c06\u65b0\u6dfb\u52a0\u7684\u5185\u5bb9\u6253\u5370\u51fa\u6765\uff0c\u4ece\u800c\u8fbe\u5230\u5b9e\u65f6\u6253\u5370\u67e5\u8be2\u7ed3\u679c\u7684\u6548\u679c\u3002 \u4f46\u662f\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0ctail \u547d\u4ee4\u53ef\u80fd\u4f1a\u5b58\u5728\u4e00\u5b9a\u7684\u5ef6\u8fdf\uff0c\u56e0\u6b64\u5b9e\u65f6\u6253\u5370\u53ef\u80fd\u4f1a\u5b58\u5728\u8f7b\u5fae\u7684\u5361\u987f\u73b0\u8c61\u3002\u5efa\u8bae\u7ed3\u5408\u5b9e\u9645\u60c5\u51b5\u9009\u62e9\u6700\u5408\u9002\u7684\u65b9\u6cd5\u3002 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-7410","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7410","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=7410"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7410\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=7410"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=7410"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=7410"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}