{"id":186898,"date":"2024-11-11T09:45:24","date_gmt":"2024-11-11T01:45:24","guid":{"rendered":"https:\/\/server.hk\/cnblog\/186898\/"},"modified":"2024-11-11T09:45:26","modified_gmt":"2024-11-11T01:45:26","slug":"%e6%95%b8%e6%93%9a%e5%ba%ab%e5%af%86%e7%a2%bc%e6%9f%a5%e8%a9%a2%e6%8a%80%e5%b7%a7-%e5%a6%82%e4%bd%95%e5%9c%a8%e6%95%b8%e6%93%9a%e5%ba%ab%e9%87%8c%e7%9a%84%e5%af%86%e7%a2%bc%e6%98%af%e4%bb%80%e9%ba%bc","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/186898\/","title":{"rendered":"\u6578\u64da\u5eab\u5bc6\u78bc\u67e5\u8a62\u6280\u5de7 (\u5982\u4f55\u5728\u6578\u64da\u5eab\u91cc\u7684\u5bc6\u78bc\u662f\u4ec0\u9ebc)"},"content":{"rendered":"<h1 id=\"%e6%95%b8%e6%93%9a%e5%ba%ab%e5%af%86%e7%a2%bc%e6%9f%a5%e8%a9%a2%e6%8a%80%e5%b7%a7-%e5%a6%82%e4%bd%95%e5%9c%a8%e6%95%b8%e6%93%9a%e5%ba%ab%e9%87%8c%e7%9a%84%e5%af%86%e7%a2%bc%e6%98%af%e4%bb%80%e9%ba%bc-lLdDgRYIBS\">\u6578\u64da\u5eab\u5bc6\u78bc\u67e5\u8a62\u6280\u5de7 (\u5982\u4f55\u5728\u6578\u64da\u5eab\u91cc\u7684\u5bc6\u78bc\u662f\u4ec0\u9ebc)<\/h1>\n<p>\u5728\u7576\u4eca\u6578\u64da\u9a45\u52d5\u7684\u4e16\u754c\u4e2d\uff0c\u6578\u64da\u5eab\u7684\u5b89\u5168\u6027\u81f3\u95dc\u91cd\u8981\u3002\u6578\u64da\u5eab\u5bc6\u78bc\u662f\u4fdd\u8b77\u6578\u64da\u7684\u7b2c\u4e00\u9053\u9632\u7dda\uff0c\u7136\u800c\uff0c\u96a8\u8457\u6642\u9593\u7684\u63a8\u79fb\uff0c\u7ba1\u7406\u548c\u67e5\u8a62\u9019\u4e9b\u5bc6\u78bc\u53ef\u80fd\u6703\u8b8a\u5f97\u8907\u96dc\u3002\u672c\u6587\u5c07\u63a2\u8a0e\u4e00\u4e9b\u6709\u6548\u7684\u6578\u64da\u5eab\u5bc6\u78bc\u67e5\u8a62\u6280\u5de7\uff0c\u5e6b\u52a9\u7528\u6236\u66f4\u597d\u5730\u7ba1\u7406\u548c\u4fdd\u8b77\u4ed6\u5011\u7684\u6578\u64da\u5eab\u3002<\/p>\n<h2 id=\"1-%e7%9e%ad%e8%a7%a3%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e7%b5%90%e6%a7%8b-lLdDgRYIBS\">1. \u77ad\u89e3\u6578\u64da\u5eab\u7684\u7d50\u69cb<\/h2>\n<p>\u5728\u67e5\u8a62\u6578\u64da\u5eab\u5bc6\u78bc\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u4e86\u89e3\u6578\u64da\u5eab\u7684\u7d50\u69cb\u3002\u4e0d\u540c\u7684\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff08DBMS\uff09\u5982 MySQL\u3001PostgreSQL \u548c Oracle \u7b49\uff0c\u5c0d\u65bc\u5bc6\u78bc\u7684\u5b58\u5132\u548c\u67e5\u8a62\u65b9\u5f0f\u6709\u6240\u4e0d\u540c\u3002\u901a\u5e38\uff0c\u5bc6\u78bc\u6703\u4ee5\u52a0\u5bc6\u5f62\u5f0f\u5b58\u5132\u5728\u7528\u6236\u8868\u4e2d\u3002<\/p>\n<h3 id=\"1-1-mysql%e4%b8%ad%e7%9a%84%e5%af%86%e7%a2%bc%e6%9f%a5%e8%a9%a2-lLdDgRYIBS\">1.1 MySQL\u4e2d\u7684\u5bc6\u78bc\u67e5\u8a62<\/h3>\n<p>\u5728 MySQL \u4e2d\uff0c\u7528\u6236\u7684\u5bc6\u78bc\u5b58\u5132\u5728 <code>mysql.user<\/code> \u8868\u4e2d\u3002\u8981\u67e5\u8a62\u7528\u6236\u7684\u5bc6\u78bc\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b SQL \u8a9e\u53e5\uff1a<\/p>\n<pre><code>SELECT User, Host, authentication_string FROM mysql.user;<\/code><\/pre>\n<p>\u9019\u5c07\u986f\u793a\u6240\u6709\u7528\u6236\u53ca\u5176\u5c0d\u61c9\u7684\u4e3b\u6a5f\u548c\u52a0\u5bc6\u5f8c\u7684\u5bc6\u78bc\u5b57\u7b26\u4e32\u3002\u8acb\u6ce8\u610f\uff0c\u76f4\u63a5\u67e5\u8a62\u660e\u6587\u5bc6\u78bc\u662f\u4e0d\u53ef\u80fd\u7684\uff0c\u56e0\u70ba\u5b83\u5011\u662f\u4ee5\u52a0\u5bc6\u5f62\u5f0f\u5b58\u5132\u7684\u3002<\/p>\n<h3 id=\"1-2-postgresql%e4%b8%ad%e7%9a%84%e5%af%86%e7%a2%bc%e6%9f%a5%e8%a9%a2-lLdDgRYIBS\">1.2 PostgreSQL\u4e2d\u7684\u5bc6\u78bc\u67e5\u8a62<\/h3>\n<p>\u5728 PostgreSQL \u4e2d\uff0c\u7528\u6236\u7684\u5bc6\u78bc\u5b58\u5132\u5728 <code>pg_authid<\/code> \u7cfb\u7d71\u76ee\u9304\u4e2d\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u67e5\u8a62\u4f86\u67e5\u770b\u7528\u6236\u7684\u5bc6\u78bc\u4fe1\u606f\uff1a<\/p>\n<pre><code>SELECT rolname, rolpassword FROM pg_authid;<\/code><\/pre>\n<p>\u540c\u6a23\uff0c\u9019\u88e1\u7684\u5bc6\u78bc\u4e5f\u662f\u4ee5\u52a0\u5bc6\u5f62\u5f0f\u5b58\u5132\u7684\uff0c\u7121\u6cd5\u76f4\u63a5\u67e5\u770b\u660e\u6587\u5bc6\u78bc\u3002<\/p>\n<h2 id=\"2-%e4%bd%bf%e7%94%a8%e9%87%8d%e7%bd%ae%e5%af%86%e7%a2%bc%e7%9a%84%e6%96%b9%e6%b3%95-lLdDgRYIBS\">2. \u4f7f\u7528\u91cd\u7f6e\u5bc6\u78bc\u7684\u65b9\u6cd5<\/h2>\n<p>\u5982\u679c\u7121\u6cd5\u67e5\u8a62\u5230\u5bc6\u78bc\uff0c\u53e6\u4e00\u7a2e\u65b9\u6cd5\u662f\u91cd\u7f6e\u5bc6\u78bc\u3002\u9019\u901a\u5e38\u662f\u6700\u5b89\u5168\u7684\u505a\u6cd5\uff0c\u7279\u5225\u662f\u5728\u61f7\u7591\u5bc6\u78bc\u88ab\u6d29\u9732\u7684\u60c5\u6cc1\u4e0b\u3002<\/p>\n<h3 id=\"2-1-mysql%e9%87%8d%e7%bd%ae%e5%af%86%e7%a2%bc-lLdDgRYIBS\">2.1 MySQL\u91cd\u7f6e\u5bc6\u78bc<\/h3>\n<p>\u5728 MySQL \u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u91cd\u7f6e\u7528\u6236\u5bc6\u78bc\uff1a<\/p>\n<pre><code>ALTER USER 'username'@'host' IDENTIFIED BY 'new_password';<\/code><\/pre>\n<h3 id=\"2-2-postgresql%e9%87%8d%e7%bd%ae%e5%af%86%e7%a2%bc-lLdDgRYIBS\">2.2 PostgreSQL\u91cd\u7f6e\u5bc6\u78bc<\/h3>\n<p>\u5728 PostgreSQL \u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u91cd\u7f6e\u7528\u6236\u5bc6\u78bc\uff1a<\/p>\n<pre><code>ALTER ROLE username WITH PASSWORD 'new_password';<\/code><\/pre>\n<h2 id=\"3-%e5%af%86%e7%a2%bc%e7%ae%a1%e7%90%86%e6%9c%80%e4%bd%b3%e5%af%a6%e8%b8%90-lLdDgRYIBS\">3. \u5bc6\u78bc\u7ba1\u7406\u6700\u4f73\u5be6\u8e10<\/h2>\n<p>\u70ba\u4e86\u78ba\u4fdd\u6578\u64da\u5eab\u7684\u5b89\u5168\u6027\uff0c\u9075\u5faa\u4e00\u4e9b\u6700\u4f73\u5be6\u8e10\u662f\u975e\u5e38\u91cd\u8981\u7684\uff1a<\/p>\n<ul>\n<li>\u5b9a\u671f\u66f4\u6539\u5bc6\u78bc\uff0c\u4e26\u4f7f\u7528\u5f37\u5bc6\u78bc\u7b56\u7565\u3002<\/li>\n<li>\u9650\u5236\u6578\u64da\u5eab\u7528\u6236\u7684\u6b0a\u9650\uff0c\u50c5\u6388\u4e88\u5fc5\u8981\u7684\u8a2a\u554f\u6b0a\u9650\u3002<\/li>\n<li>\u4f7f\u7528\u52a0\u5bc6\u6280\u8853\u4f86\u4fdd\u8b77\u6578\u64da\u5eab\u4e2d\u7684\u654f\u611f\u4fe1\u606f\u3002<\/li>\n<li>\u5b9a\u671f\u5099\u4efd\u6578\u64da\u5eab\uff0c\u4ee5\u9632\u6578\u64da\u4e1f\u5931\u6216\u640d\u58de\u3002<\/li>\n<\/ul>\n<h2 id=\"4-%e7%b5%90%e8%ab%96-lLdDgRYIBS\">4. \u7d50\u8ad6<\/h2>\n<p>\u67e5\u8a62\u6578\u64da\u5eab\u4e2d\u7684\u5bc6\u78bc\u4e26\u4e0d\u662f\u4e00\u4ef6\u7c21\u55ae\u7684\u4e8b\u60c5\uff0c\u56e0\u70ba\u5bc6\u78bc\u901a\u5e38\u4ee5\u52a0\u5bc6\u5f62\u5f0f\u5b58\u5132\u3002\u4e86\u89e3\u6578\u64da\u5eab\u7684\u7d50\u69cb\u548c\u4f7f\u7528\u91cd\u7f6e\u5bc6\u78bc\u7684\u65b9\u6cd5\u662f\u7ba1\u7406\u6578\u64da\u5eab\u5b89\u5168\u7684\u91cd\u8981\u6b65\u9a5f\u3002\u6b64\u5916\uff0c\u9075\u5faa\u6700\u4f73\u5be6\u8e10\u53ef\u4ee5\u9032\u4e00\u6b65\u589e\u5f37\u6578\u64da\u5eab\u7684\u5b89\u5168\u6027\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u53ef\u9760\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u89e3\u6c7a\u65b9\u6848\u4f86\u6258\u7ba1\u60a8\u7684\u6578\u64da\u5eab\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u6eff\u8db3\u4e0d\u540c\u9700\u6c42\u3002\u7121\u8ad6\u662f <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u9084\u662f\u5176\u4ed6\u670d\u52d9\uff0c\u6211\u5011\u90fd\u80fd\u70ba\u60a8\u63d0\u4f9b\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u638c\u63e1\u6578\u64da\u5eab\u5bc6\u78bc\u67e5\u8a62\u6280\u5de7\uff0c\u5b78\u7fd2\u5982\u4f55\u6709\u6548\u67e5\u627e\u548c\u7ba1\u7406\u6578\u64da\u5eab\u4e2d\u7684\u5bc6\u78bc\uff0c\u78ba\u4fdd\u5b89\u5168\u8207\u6548\u7387\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-186898","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/186898","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=186898"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/186898\/revisions"}],"predecessor-version":[{"id":186899,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/186898\/revisions\/186899"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=186898"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=186898"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=186898"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}