{"id":5499,"date":"2024-11-14T11:00:45","date_gmt":"2024-11-14T03:00:45","guid":{"rendered":"https:\/\/fwq.ai\/blog\/5499\/"},"modified":"2024-11-14T11:00:45","modified_gmt":"2024-11-14T03:00:45","slug":"mysql%e6%80%8e%e4%b9%88%e5%90%af%e5%8a%a8%e5%91%bd%e4%bb%a4","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/5499\/","title":{"rendered":"mysql\u600e\u4e48\u542f\u52a8\u547d\u4ee4"},"content":{"rendered":"<blockquote><p>\n  \u6709\u4e24\u79cd\u542f\u52a8 mysql \u547d\u4ee4\u884c\u7684\u65b9\u5f0f\uff1a\u4f7f\u7528 mysqld_safe\uff08\u5305\u88c5\u811a\u672c\uff09\u6216 mysqld\uff08\u53ef\u6267\u884c\u6587\u4ef6\uff09\u3002mysqld_safe \u4f1a\u5904\u7406\u5e38\u89c1\u9519\u8bef\uff0c\u800c mysqld \u9700\u8981\u624b\u52a8\u6307\u5b9a\u914d\u7f6e\u6587\u4ef6\u548c\u5176\u4ed6\u9009\u9879\u3002\u4f7f\u7528 sudo \u6743\u9650\u5e76\u67e5\u770b\u9519\u8bef\u65e5\u5fd7\u4ee5\u89e3\u51b3\u4efb\u4f55\u95ee\u9898\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/29\/2024052904512164377.jpg\" class=\"aligncenter\" title=\"mysql\u600e\u4e48\u542f\u52a8\u547d\u4ee4\u63d2\u56fe\" alt=\"mysql\u600e\u4e48\u542f\u52a8\u547d\u4ee4\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u542f\u52a8 MySQL \u547d\u4ee4\u884c<\/strong><\/p>\n<p>\u542f\u52a8 MySQL \u547d\u4ee4\u884c\u6709\u4e24\u79cd\u4e3b\u8981\u65b9\u6cd5\uff1a<\/p>\n<p><strong>1. \u4f7f\u7528 d_safe<\/strong><\/p>\n<p>mysqld_safe \u662f\u4e00\u4e2a\u5305\u88c5\u811a\u672c\uff0c\u5b83\u542f\u52a8 MySQL \u670d\u52a1\u5668\u5e76\u5904\u7406\u5e38\u89c1\u9519\u8bef\uff0c\u5982\u7aef\u53e3\u51b2\u7a81\u3002\u8981\u4f7f\u7528\u6b64\u65b9\u6cd5\uff1a<\/p>\n<pre>$ sudo mysqld_safe<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u4f7f\u7528 mysqld<\/strong><\/p>\n<p>mysqld \u662f MySQL \u670d\u52a1\u5668\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002\u8981\u76f4\u63a5\u542f\u52a8\u670d\u52a1\u5668\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>$ sudo mysqld --defaults-file=\/etc\/mysql\/my.cnf<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5176\u4e2d \/etc\/my.cnf \u662f MySQL \u7684\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<p><strong>\u5176\u4ed6\u9009\u9879\uff1a<\/strong><\/p>\n<ul>\n<li> <strong>&#8211;help<\/strong>\uff1a\u663e\u793a\u6240\u6709\u53ef\u7528\u9009\u9879\u7684\u5e2e\u52a9\u5217\u8868\u3002<\/li>\n<li> <strong>&#8211;verbose<\/strong>\uff1a\u663e\u793a\u542f\u52a8\u8fc7\u7a0b\u4e2d\u7684\u8be6\u7ec6\u8f93\u51fa\u3002<\/li>\n<li> <strong>&#8211;port=PORT_NUMBER<\/strong>\uff1a\u6307\u5b9a MySQL \u670d\u52a1\u5668\u4fa6\u542c\u7684\u7aef\u53e3\u3002<\/li>\n<li> <strong>&#8211;datadir=DATA_DIRECTORY<\/strong>\uff1a\u6307\u5b9a MySQL \u5b58\u50a8\u6570\u636e\u6587\u4ef6\u7684\u76ee\u5f55\u3002<\/li>\n<\/ul>\n<p><strong>\u6ce8\u610f\uff1a<\/strong><\/p>\n<ul>\n<li>\u786e\u4fdd\u4f60\u6709 root \u6743\u9650\u6216\u4ee5 root \u7528\u6237\u8eab\u4efd\u8fd0\u884c\u547d\u4ee4\u3002<\/li>\n<li>\u5982\u679c MySQL \u5df2\u7ecf\u5728\u8fd0\u884c\uff0c\u8fd9\u4e9b\u547d\u4ee4\u5c06\u5931\u8d25\u3002<\/li>\n<li>\u5982\u679c\u9047\u5230\u4efb\u4f55\u95ee\u9898\uff0c\u53ef\u4ee5\u68c0\u67e5 MySQL \u9519\u8bef\u65e5\u5fd7\uff08\u901a\u5e38\u4f4d\u4e8e \/var\/log\/mysql\/error.log\uff09\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u542f\u52a8\u547d\u4ee4\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>\u6709\u4e24\u79cd\u542f\u52a8 mysql \u547d\u4ee4\u884c\u7684\u65b9\u5f0f\uff1a\u4f7f\u7528 mysqld_safe\uff08\u5305\u88c5\u811a\u672c\uff09\u6216 mysqld\uff08\u53ef\u6267\u884c\u6587\u4ef6\uff09\u3002mysqld_safe \u4f1a\u5904\u7406\u5e38\u89c1\u9519\u8bef\uff0c\u800c mysqld \u9700\u8981\u624b\u52a8\u6307\u5b9a\u914d\u7f6e\u6587\u4ef6\u548c\u5176\u4ed6\u9009\u9879\u3002\u4f7f\u7528 sudo \u6743\u9650\u5e76\u67e5\u770b\u9519\u8bef\u65e5\u5fd7\u4ee5\u89e3\u51b3\u4efb\u4f55\u95ee\u9898\u3002 \u5982\u4f55\u542f\u52a8 MySQL \u547d\u4ee4\u884c \u542f\u52a8 MySQL \u547d\u4ee4\u884c\u6709\u4e24\u79cd\u4e3b\u8981\u65b9\u6cd5\uff1a 1. \u4f7f\u7528 d_safe mysqld_safe \u662f\u4e00\u4e2a\u5305\u88c5\u811a\u672c\uff0c\u5b83\u542f\u52a8 MySQL \u670d\u52a1\u5668\u5e76\u5904\u7406\u5e38\u89c1\u9519\u8bef\uff0c\u5982\u7aef\u53e3\u51b2\u7a81\u3002\u8981\u4f7f\u7528\u6b64\u65b9\u6cd5\uff1a $ sudo mysqld_safe \u767b\u5f55\u540e\u590d\u5236 2. \u4f7f\u7528 mysqld mysqld \u662f MySQL \u670d\u52a1\u5668\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002\u8981\u76f4\u63a5\u542f\u52a8\u670d\u52a1\u5668\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a $ sudo mysqld &#8211;defaults-file=\/etc\/mysql\/my.cnf \u767b\u5f55\u540e\u590d\u5236 \u5176\u4e2d \/etc\/my.cnf \u662f MySQL \u7684\u914d\u7f6e\u6587\u4ef6\u3002 \u5176\u4ed6\u9009\u9879\uff1a &#8211;help\uff1a\u663e\u793a\u6240\u6709\u53ef\u7528\u9009\u9879\u7684\u5e2e\u52a9\u5217\u8868\u3002 &#8211;verbose\uff1a\u663e\u793a\u542f\u52a8\u8fc7\u7a0b\u4e2d\u7684\u8be6\u7ec6\u8f93\u51fa\u3002 &#8211;port=PORT_NUMBER\uff1a\u6307\u5b9a MySQL \u670d\u52a1\u5668\u4fa6\u542c\u7684\u7aef\u53e3\u3002 &#8211;datadir=DATA_DIRECTORY\uff1a\u6307\u5b9a MySQL \u5b58\u50a8\u6570\u636e\u6587\u4ef6\u7684\u76ee\u5f55\u3002 \u6ce8\u610f\uff1a \u786e\u4fdd\u4f60\u6709 [&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-5499","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5499","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=5499"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5499\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=5499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=5499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=5499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}