{"id":200127,"date":"2025-05-06T10:36:27","date_gmt":"2025-05-06T02:36:27","guid":{"rendered":"https:\/\/server.hk\/cnblog\/200127\/"},"modified":"2025-05-06T10:36:27","modified_gmt":"2025-05-06T02:36:27","slug":"solusi-mysql-%e9%94%99%e8%af%af%e6%97%a0%e6%b3%95%e5%90%af%e5%8a%a8","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/200127\/","title":{"rendered":"Solusi MySQL \u9519\u8bef\u65e0\u6cd5\u542f\u52a8"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>Solusi MySQL \u9519\u8bef\u65e0\u6cd5\u542f\u52a8<\/h1>\n<p>\u4e3b\u673a\u5b9d\u8d1d\u4eca\u5929\u5c06\u7ed9\u5927\u5bb6\u5e26\u6765\uff0c\u611f\u5174\u8da3\u7684\u670b\u53cb\u8bf7\u7ee7\u7eed\u770b\u4e0b\u53bb\u5427\uff01\u4ee5\u4e0b\u5185\u5bb9\u5c06\u4f1a\u6d89\u53ca\u5230\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5982\u679c\u4f60\u662f\u6b63\u5728\u5b66\u4e60\u6216\u8005\u5df2\u7ecf\u662f\u5927\u4f6c\u7ea7\u522b\u4e86\uff0c\u90fd\u975e\u5e38\u6b22\u8fce\u4e5f\u5e0c\u671b\u5927\u5bb6\u90fd\u80fd\u7ed9\u6211\u5efa\u8bae\u8bc4\u8bba\u54c8~\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u5927\u5bb6\uff01<\/p>\n<p>\u670b\u53cb\u4eec\u5927\u5bb6\u597d\uff0c\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\u6211\u60f3\u5206\u4eab\u4e00\u4e2a\u5904\u7406 mysql 8.0 \u7684\u6559\u7a0b\uff0c\u5f53\u4f60\u5347\u7ea7\u5230 mysql 8.0 \u65f6\uff0c\u8be5\u6559\u7a0b\u5c06\u4e0d\u4f1a\u542f\u52a8<\/p>\n<h2> \u53d1\u751f\u7684\u9519\u8bef <\/h2>\n<p>\u597d\u5427\uff0c\u5f53\u6211\u5728 laragon \u5e94\u7528\u7a0b\u5e8f\u4e2d\u4ece<strong>mysql 5.1.72<\/strong>\u5347\u7ea7\u5230<strong>mysql 8.0.32<\/strong>\u65f6\uff0c\u53d1\u751f\u4e86\u8fd9\u4e2a\u9519\u8bef\u3002<\/p>\n<p>\u5f53\u6211\u5728 laragon \u5e94\u7528\u7a0b\u5e8f\u4e2d start all \u65f6\uff0c\u51fa\u73b0\u7684\u9519\u8bef\u662f\u8fd9\u6837\u7684\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20240819\/172406865366c3332d81cdd.png\" class=\"aligncenter\"><\/p>\n<p>laragon \u4e2d\u7684 mysql 8.0 \u9519\u8bef<\/p>\n<p>\u7136\u540e\u6211\u68c0\u67e5\u4e86\u4f4d\u4e8e<em>c:laragondatamysql-8mysqld.log\u7684\u65e5\u5fd7\u6587\u4ef6<\/em><\/p>\n<p>\u5728\u90a3\u91cc\u6211\u53d1\u73b0\u4e86\u5982\u4e0b\u9519\u8bef<\/p>\n<pre>mysqld: table 'mysql.plugin' doesn't exist\n2023-02-16t23:34:54.041942z 0 [error] [my-010735] [server] could not open the mysql.plugin table. please perform the mysql upgrade procedure.\n<\/pre>\n<p>\u9664\u6b64\u4e4b\u5916\uff0c\u6211\u8fd8\u53d1\u73b0\u4e86\u8fd9\u6837\u7684\u9519\u8bef<\/p>\n<pre>2023-02-16t23:34:54.460889z 0 [error] [my-010326] [server] fatal error: can't open and lock privilege tables: table 'mysql.user' doesn't exist\n2023-02-16t23:34:54.462984z 0 [error] [my-010952] [server] the privilege system failed to initialize correctly. for complete instructions on how to upgrade mysql to a new version please see the 'upgrading mysql' section from the mysql manual.\n<\/pre>\n<p>\u4ece\u8fd9\u4e2a\u9519\u8bef\u53ef\u4ee5\u660e\u663e\u770b\u51fa\u6211\u6240\u505a\u7684\u5347\u7ea7\u8fc7\u7a0b\u662f\u9519\u8bef\u7684\u3002 <strong>\u9519\u8bef\u662f\u6211\u6ca1\u6709\u5148\u521d\u59cb\u5316mysql 8.0\uff0c\u6240\u4ee5mysql 8.0\u627e\u4e0d\u5230\u6211\u9700\u8981\u7684\u8868<\/strong>.<\/p>\n<h2> \u89e3\u51b3\u65b9\u6848\uff1a\u521d\u59cb\u5316mysql <\/h2>\n<p>\u597d\u7684\uff0c\u6240\u4ee5\u6211\u4eec\u8981\u505a\u7684\u89e3\u51b3\u65b9\u6848\u662f\u5148\u542f\u52a8mysql 8.0\uff0c\u7136\u540e\u518d\u542f\u52a8mysql\u670d\u52a1\u5668\u3002<\/p>\n<p>\u5728 windows \u4e2d\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff0c\u7136\u540e\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4<\/p>\n<pre>mysqld --initialize-insecure\n<\/pre>\n<p>\u5176\u5b9e\u67092\u4e2a\u9009\u9879\uff0c\u7b2c\u4e00\u4e2a\u4f7f\u7528<strong>\u2013initialize<\/strong>\uff0c\u7b2c\u4e8c\u4e2a<strong>\u2013initialize-insecure<\/strong>\u3002\u552f\u4e00\u7684\u533a\u522b\u662f root \u5e10\u6237\u7684\u5bc6\u7801\u3002\u7b2c\u4e00\u4e2a\u9009\u9879\u5c06\u751f\u6210\u4e00\u4e2a\u4e34\u65f6\u968f\u673a\u5bc6\u7801\u3002\u5bf9\u4e8e\u7b2c\u4e8c\u4e2a\u9009\u9879\uff0croot\u8d26\u6237\u6ca1\u6709\u5bc6\u7801\uff0c\u4f46\u662f\u7a0d\u540e\u6211\u4eec\u53ef\u4ee5\u4e3aroot\u8bbe\u7f6e\u5bc6\u7801\u3002<\/p>\n<p>\u597d\u4e86\uff0c\u542f\u52a8mysql 8.0\u7684\u8fc7\u7a0b\u5c31\u5b8c\u6210\u4e86\uff0c\u5230\u8fd9\u91cc\u5e94\u8be5\u5c31\u53ef\u4ee5\u542f\u52a8mysql 8.0\u6216\u8005\u670d\u52a1\u5668\u53ef\u4ee5\u6b63\u5e38\u8fd0\u884c\u4e86\u3002<\/p>\n<h2> \u66f4\u6539\u6839\u5bc6\u7801 <\/h2>\n<p>\u56e0\u4e3a\u6211\u4eec\u4f7f\u7528\u4e86\u7b2c\u4e8c\u4e2a\u9009\u9879\uff0c\u8fd9\u610f\u5473\u7740 root \u5e10\u6237\u6ca1\u6709\u5bc6\u7801\uff0c\u56e0\u6b64\u65e0\u9700\u4f7f\u7528\u5bc6\u7801\u5373\u53ef\u8f7b\u677e\u8bbf\u95ee\u3002\u5982\u679c\u662f\u5728\u672c\u5730\u7535\u8111\u4e0a\u4e5f\u8fd8\u53ef\u4ee5\uff0c\u56e0\u4e3aweb\u5f00\u53d1\u9700\u6c42\u4e5f\u66f4\u5feb<\/p>\n<p>\u4f46\u662f\u5982\u679c\u670b\u53cb\u60f3\u4e3aroot\u8d26\u6237\u6dfb\u52a0\u5bc6\u7801\uff0c\u4e5f\u5f88\u7b80\u5355<\/p>\n<p>\u9996\u5148\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u5165mysql\u547d\u4ee4\u884c\u3002<\/p>\n<pre>mysql -u root\n<\/pre>\n<p>\u767b\u5f55\u540e\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u3002\u4e0d\u8981\u5fd8\u8bb0\u6700\u540e\u4e00\u4e2a\u5206\u53f7\u3002<\/p>\n<pre>alter user 'root'@'localhost' identified by 'password_baru_untuk_root';\n<\/pre>\n<p>\u5c06 <strong>new_password_for_root<\/strong> \u66f4\u6539\u4e3a\u60a8\u60f3\u8981\u7684\u5bc6\u7801\u3002\u7136\u540e\u8fdb\u5165\u3002<\/p>\n<p>\u73b0\u5728\u8fd0\u884c\u547d\u4ee4<strong>exit<\/strong>\u9000\u51famysql\u547d\u4ee4\u884c\u3002\u7136\u540e\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u3002\u7136\u540e\u8f93\u5165\u60a8\u4e4b\u524d\u521b\u5efa\u7684\u65b0\u5bc6\u7801\u3002<\/p>\n<pre>mysql -u root -p\n<\/pre>\n<p>\u795d\u4f60\u5c1d\u8bd5\u987a\u5229 ?<\/p>\n<p>\u7ec8\u4e8e\u4ecb\u7ecd\u5b8c\u5566\uff01\u5c0f\u4f19\u4f34\u4eec\uff0c\u8fd9\u7bc7\u5173\u4e8e\u300aSolusi MySQL \u9519\u8bef\u65e0\u6cd5\u542f\u52a8\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<p> \u7248\u672c\u58f0\u660e \u672c\u6587\u8f6c\u8f7d\u4e8e\uff1adev.to \u5982\u6709\u4fb5\u72af\uff0c\u8bf7\u8054\u7cfb \u5220\u9664 <\/p>\n<dl>\n<dt>\n <\/dt>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>Solusi MySQL \u9519\u8bef\u65e0&#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-200127","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200127","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=200127"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200127\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=200127"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=200127"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=200127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}