{"id":171201,"date":"2024-11-07T00:46:24","date_gmt":"2024-11-06T16:46:24","guid":{"rendered":"https:\/\/server.hk\/cnblog\/171201\/"},"modified":"2024-11-07T00:46:25","modified_gmt":"2024-11-06T16:46:25","slug":"%e5%95%9f%e5%8b%95%e8%88%87%e9%97%9c%e9%96%89mysql%e7%9a%84%e4%b8%80%e5%a4%a7%e7%b5%95%e6%8b%9b","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/171201\/","title":{"rendered":"\u555f\u52d5\u8207\u95dc\u9589MySQL\u7684\u4e00\u5927\u7d55\u62db"},"content":{"rendered":"<h1 id=\"%e5%95%9f%e5%8b%95%e8%88%87%e9%97%9c%e9%96%89mysql%e7%9a%84%e4%b8%80%e5%a4%a7%e7%b5%95%e6%8b%9b-PRkjymECUX\">\u555f\u52d5\u8207\u95dc\u9589MySQL\u7684\u4e00\u5927\u7d55\u62db<\/h1>\n<p>MySQL\u662f\u4e00\u500b\u5ee3\u6cdb\u4f7f\u7528\u7684\u958b\u6e90\u95dc\u806f\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u8a31\u591a\u7db2\u7ad9\u548c\u61c9\u7528\u7a0b\u5e8f\u90fd\u4f9d\u8cf4\u5b83\u4f86\u5b58\u5132\u548c\u7ba1\u7406\u6578\u64da\u3002\u7121\u8ad6\u662f\u958b\u767c\u74b0\u5883\u9084\u662f\u751f\u7522\u74b0\u5883\uff0c\u6b63\u78ba\u5730\u555f\u52d5\u548c\u95dc\u9589MySQL\u670d\u52d9\u90fd\u662f\u81f3\u95dc\u91cd\u8981\u7684\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u4e00\u4e9b\u555f\u52d5\u8207\u95dc\u9589MySQL\u7684\u6280\u5de7\uff0c\u5e6b\u52a9\u7528\u6236\u66f4\u6709\u6548\u5730\u7ba1\u7406\u5176\u6578\u64da\u5eab\u3002<\/p>\n<h2 id=\"%e5%95%9f%e5%8b%95mysql%e6%9c%8d%e5%8b%99-PRkjymECUX\">\u555f\u52d5MySQL\u670d\u52d9<\/h2>\n<p>\u5728\u5927\u591a\u6578Linux\u7cfb\u7d71\u4e2d\uff0c\u555f\u52d5MySQL\u670d\u52d9\u7684\u547d\u4ee4\u76f8\u5c0d\u7c21\u55ae\u3002\u7528\u6236\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u555f\u52d5MySQL\u670d\u52d9\uff1a<\/p>\n<pre><code>sudo systemctl start mysql<\/code><\/pre>\n<p>\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662f\u8f03\u820a\u7248\u672c\u7684Linux\uff0c\u53ef\u80fd\u9700\u8981\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>sudo service mysql start<\/code><\/pre>\n<p>\u5728Windows\u7cfb\u7d71\u4e2d\uff0c\u60a8\u53ef\u4ee5\u901a\u904e\u670d\u52d9\u7ba1\u7406\u5668\u4f86\u555f\u52d5MySQL\u670d\u52d9\uff0c\u6216\u8005\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\uff1a<\/p>\n<pre><code>net start mysql<\/code><\/pre>\n<h3 id=\"%e6%aa%a2%e6%9f%a5mysql%e6%9c%8d%e5%8b%99%e7%8b%80%e6%85%8b-PRkjymECUX\">\u6aa2\u67e5MySQL\u670d\u52d9\u72c0\u614b<\/h3>\n<p>\u555f\u52d5MySQL\u670d\u52d9\u5f8c\uff0c\u6aa2\u67e5\u5176\u72c0\u614b\u662f\u500b\u597d\u7fd2\u6163\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u78ba\u8a8dMySQL\u662f\u5426\u6b63\u5728\u904b\u884c\uff1a<\/p>\n<pre><code>sudo systemctl status mysql<\/code><\/pre>\n<p>\u5982\u679c\u670d\u52d9\u6b63\u5728\u904b\u884c\uff0c\u60a8\u5c07\u770b\u5230\u985e\u4f3c\u65bc\u201cactive (running)\u201d\u7684\u72c0\u614b\u4fe1\u606f\u3002<\/p>\n<h2 id=\"%e9%97%9c%e9%96%89mysql%e6%9c%8d%e5%8b%99-PRkjymECUX\">\u95dc\u9589MySQL\u670d\u52d9<\/h2>\n<p>\u5728\u9700\u8981\u95dc\u9589MySQL\u670d\u52d9\u6642\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>sudo systemctl stop mysql<\/code><\/pre>\n<p>\u5c0d\u65bc\u8f03\u820a\u7684\u7cfb\u7d71\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\uff1a<\/p>\n<pre><code>sudo service mysql stop<\/code><\/pre>\n<p>\u5728Windows\u7cfb\u7d71\u4e2d\uff0c\u60a8\u53ef\u4ee5\u901a\u904e\u670d\u52d9\u7ba1\u7406\u5668\u4f86\u505c\u6b62MySQL\u670d\u52d9\uff0c\u6216\u8005\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\uff1a<\/p>\n<pre><code>net stop mysql<\/code><\/pre>\n<h3 id=\"%e5%ae%89%e5%85%a8%e9%97%9c%e9%96%89mysql-PRkjymECUX\">\u5b89\u5168\u95dc\u9589MySQL<\/h3>\n<p>\u5728\u67d0\u4e9b\u60c5\u6cc1\u4e0b\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u5b89\u5168\u5730\u95dc\u9589MySQL\uff0c\u4ee5\u78ba\u4fdd\u6240\u6709\u6b63\u5728\u9032\u884c\u7684\u4e8b\u52d9\u90fd\u80fd\u5920\u6b63\u78ba\u5b8c\u6210\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u5b89\u5168\u95dc\u9589MySQL\uff1a<\/p>\n<pre><code>mysqladmin -u root -p shutdown<\/code><\/pre>\n<p>\u9019\u500b\u547d\u4ee4\u6703\u8981\u6c42\u60a8\u8f38\u5165MySQL\u7684root\u7528\u6236\u5bc6\u78bc\uff0c\u7136\u5f8c\u5b89\u5168\u5730\u95dc\u9589\u670d\u52d9\u3002<\/p>\n<h2 id=\"%e4%bd%bf%e7%94%a8%e8%85%b3%e6%9c%ac%e8%87%aa%e5%8b%95%e5%8c%96%e5%95%9f%e5%8b%95%e8%88%87%e9%97%9c%e9%96%89-PRkjymECUX\">\u4f7f\u7528\u8173\u672c\u81ea\u52d5\u5316\u555f\u52d5\u8207\u95dc\u9589<\/h2>\n<p>\u5c0d\u65bc\u9700\u8981\u983b\u7e41\u555f\u52d5\u548c\u95dc\u9589MySQL\u7684\u7528\u6236\uff0c\u7de8\u5beb\u4e00\u500b\u7c21\u55ae\u7684\u8173\u672c\u53ef\u4ee5\u7bc0\u7701\u6642\u9593\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u57fa\u672c\u7684Bash\u8173\u672c\u793a\u4f8b\uff1a<\/p>\n<pre><code>#!\/bin\/bash\ncase \"$1\" in\n  start)\n    sudo systemctl start mysql\n    ;;\n  stop)\n    sudo systemctl stop mysql\n    ;;\n  status)\n    sudo systemctl status mysql\n    ;;\n  *)\n    echo \"Usage: $0 {start|stop|status}\"\n    exit 1\n    ;;\nesac\nexit 0<\/code><\/pre>\n<p>\u5c07\u4e0a\u8ff0\u4ee3\u78bc\u4fdd\u5b58\u70ba\u540d\u70bamysql_control.sh\u7684\u6587\u4ef6\uff0c\u7136\u5f8c\u7d66\u4e88\u57f7\u884c\u6b0a\u9650\uff1a<\/p>\n<pre><code>chmod +x mysql_control.sh<\/code><\/pre>\n<p>\u73fe\u5728\uff0c\u60a8\u53ef\u4ee5\u901a\u904e\u57f7\u884c\u4ee5\u4e0b\u547d\u4ee4\u4f86\u555f\u52d5\u3001\u505c\u6b62\u6216\u6aa2\u67e5MySQL\u670d\u52d9\u7684\u72c0\u614b\uff1a<\/p>\n<pre><code>.\/mysql_control.sh start<\/code><\/pre>\n<h2 id=\"%e7%b8%bd%e7%b5%90-PRkjymECUX\">\u7e3d\u7d50<\/h2>\n<p>\u6b63\u78ba\u5730\u555f\u52d5\u8207\u95dc\u9589MySQL\u670d\u52d9\u5c0d\u65bc\u6578\u64da\u5eab\u7684\u7a69\u5b9a\u6027\u548c\u5b89\u5168\u6027\u81f3\u95dc\u91cd\u8981\u3002\u7121\u8ad6\u662f\u4f7f\u7528\u547d\u4ee4\u884c\u9084\u662f\u8173\u672c\u81ea\u52d5\u5316\uff0c\u4e86\u89e3\u5982\u4f55\u6709\u6548\u7ba1\u7406MySQL\u670d\u52d9\u90fd\u80fd\u63d0\u9ad8\u5de5\u4f5c\u6548\u7387\u3002\u5982\u679c\u60a8\u9700\u8981\u66f4\u9ad8\u6548\u7684\u6578\u64da\u5eab\u89e3\u6c7a\u65b9\u6848\uff0c\u8003\u616e\u4f7f\u7528<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u6216<a href=\"https:\/\/server.hk\">\u4e91\u670d\u52a1\u5668<\/a>\u4f86\u652f\u6301\u60a8\u7684\u61c9\u7528\u7a0b\u5e8f\u548c\u7db2\u7ad9\u3002\u9019\u4e9b\u670d\u52d9\u80fd\u5920\u63d0\u4f9b\u7a69\u5b9a\u7684\u6027\u80fd\u548c\u9748\u6d3b\u7684\u914d\u7f6e\u9078\u64c7\uff0c\u6eff\u8db3\u4e0d\u540c\u7528\u6236\u7684\u9700\u6c42\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u638c\u63e1\u555f\u52d5\u8207\u95dc\u9589MySQL\u7684\u6280\u5de7\uff0c\u63d0\u5347\u6578\u64da\u5eab\u7ba1\u7406\u6548\u7387\uff0c\u78ba\u4fdd\u7cfb\u7d71\u7a69\u5b9a\u904b\u884c\uff0c\u8b93\u4f60\u7684\u6578\u64da\u5eab\u64cd\u4f5c\u66f4\u5f97\u5fc3\u61c9\u624b\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-171201","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/171201","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"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=171201"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/171201\/revisions"}],"predecessor-version":[{"id":171202,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/171201\/revisions\/171202"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=171201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=171201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=171201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}