{"id":186906,"date":"2024-11-11T09:49:25","date_gmt":"2024-11-11T01:49:25","guid":{"rendered":"https:\/\/server.hk\/cnblog\/186906\/"},"modified":"2024-11-11T09:49:26","modified_gmt":"2024-11-11T01:49:26","slug":"%e6%95%b8%e6%93%9a%e5%ba%ab%e5%af%86%e7%a2%bc%e9%87%8d%e7%bd%ae%e6%96%b9%e6%b3%95%e8%a9%b3%e8%a7%a3-%e6%95%b8%e6%93%9a%e5%ba%ab%e6%94%b9%e5%af%86%e7%a2%bc%e8%aa%9e%e5%8f%a5","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/186906\/","title":{"rendered":"\u6578\u64da\u5eab\u5bc6\u78bc\u91cd\u7f6e\u65b9\u6cd5\u8a73\u89e3 (\u6578\u64da\u5eab\u6539\u5bc6\u78bc\u8a9e\u53e5)"},"content":{"rendered":"<h1 id=\"%e6%95%b8%e6%93%9a%e5%ba%ab%e5%af%86%e7%a2%bc%e9%87%8d%e7%bd%ae%e6%96%b9%e6%b3%95%e8%a9%b3%e8%a7%a3-%e6%95%b8%e6%93%9a%e5%ba%ab%e6%94%b9%e5%af%86%e7%a2%bc%e8%aa%9e%e5%8f%a5-wGEmxOZtvr\">\u6578\u64da\u5eab\u5bc6\u78bc\u91cd\u7f6e\u65b9\u6cd5\u8a73\u89e3 (\u6578\u64da\u5eab\u6539\u5bc6\u78bc\u8a9e\u53e5)<\/h1>\n<p>\u5728\u73fe\u4eca\u7684\u6578\u64da\u9a45\u52d5\u6642\u4ee3\uff0c\u6578\u64da\u5eab\u7684\u5b89\u5168\u6027\u81f3\u95dc\u91cd\u8981\u3002\u6578\u64da\u5eab\u5bc6\u78bc\u7684\u7ba1\u7406\u548c\u91cd\u7f6e\u662f\u78ba\u4fdd\u6578\u64da\u5b89\u5168\u7684\u4e00\u500b\u91cd\u8981\u74b0\u7bc0\u3002\u672c\u6587\u5c07\u8a73\u7d30\u4ecb\u7d39\u6578\u64da\u5eab\u5bc6\u78bc\u7684\u91cd\u7f6e\u65b9\u6cd5\uff0c\u4e26\u63d0\u4f9b\u76f8\u61c9\u7684\u8a9e\u53e5\u793a\u4f8b\uff0c\u5e6b\u52a9\u7528\u6236\u66f4\u597d\u5730\u7ba1\u7406\u5176\u6578\u64da\u5eab\u3002<\/p>\n<h2 id=\"%e7%82%ba%e4%bb%80%e9%ba%bc%e9%9c%80%e8%a6%81%e9%87%8d%e7%bd%ae%e6%95%b8%e6%93%9a%e5%ba%ab%e5%af%86%e7%a2%bc%ef%bc%9f-wGEmxOZtvr\">\u70ba\u4ec0\u9ebc\u9700\u8981\u91cd\u7f6e\u6578\u64da\u5eab\u5bc6\u78bc\uff1f<\/h2>\n<p>\u6578\u64da\u5eab\u5bc6\u78bc\u91cd\u7f6e\u7684\u539f\u56e0\u6709\u5f88\u591a\uff0c\u4e3b\u8981\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u5b89\u5168\u6027\u8003\u91cf\uff1a\u5982\u679c\u61f7\u7591\u5bc6\u78bc\u88ab\u6d29\u9732\uff0c\u61c9\u7acb\u5373\u91cd\u7f6e\u3002<\/li>\n<li>\u5b9a\u671f\u66f4\u65b0\uff1a\u70ba\u4e86\u9632\u6b62\u6f5b\u5728\u7684\u5b89\u5168\u5a01\u8105\uff0c\u5efa\u8b70\u5b9a\u671f\u66f4\u63db\u5bc6\u78bc\u3002<\/li>\n<li>\u7528\u6236\u7ba1\u7406\uff1a\u7576\u7528\u6236\u96e2\u8077\u6216\u4e0d\u518d\u9700\u8981\u8a2a\u554f\u6578\u64da\u5eab\u6642\uff0c\u61c9\u91cd\u7f6e\u5176\u5bc6\u78bc\u3002<\/li>\n<\/ul>\n<h2 id=\"%e4%b8%8d%e5%90%8c%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e5%af%86%e7%a2%bc%e9%87%8d%e7%bd%ae%e6%96%b9%e6%b3%95-wGEmxOZtvr\">\u4e0d\u540c\u6578\u64da\u5eab\u7684\u5bc6\u78bc\u91cd\u7f6e\u65b9\u6cd5<\/h2>\n<h3 id=\"mysql-wGEmxOZtvr\">MySQL<\/h3>\n<p>\u5728MySQL\u4e2d\uff0c\u91cd\u7f6e\u5bc6\u78bc\u7684\u904e\u7a0b\u76f8\u5c0d\u7c21\u55ae\u3002\u4ee5\u4e0b\u662f\u5177\u9ad4\u6b65\u9a5f\uff1a<\/p>\n<ol>\n<li>\u9996\u5148\uff0c\u505c\u6b62MySQL\u670d\u52d9\uff1a<\/li>\n<pre><code>sudo systemctl stop mysql<\/code><\/pre>\n<li>\u7136\u5f8c\uff0c\u4ee5\u5b89\u5168\u6a21\u5f0f\u555f\u52d5MySQL\uff1a<\/li>\n<pre><code>sudo mysqld_safe --skip-grant-tables &amp;<\/code><\/pre>\n<li>\u63a5\u4e0b\u4f86\uff0c\u4f7f\u7528MySQL\u5ba2\u6236\u7aef\u9023\u63a5\u5230\u6578\u64da\u5eab\uff1a<\/li>\n<pre><code>mysql -u root<\/code><\/pre>\n<li>\u5728MySQL\u63d0\u793a\u7b26\u4e0b\uff0c\u57f7\u884c\u4ee5\u4e0b\u8a9e\u53e5\u4f86\u91cd\u7f6e\u5bc6\u78bc\uff1a<\/li>\n<pre><code>FLUSH PRIVILEGES;<\/code><\/pre>\n<pre><code>ALTER USER 'root'@'localhost' IDENTIFIED BY '\u65b0\u5bc6\u78bc';<\/code><\/pre>\n<li>\u6700\u5f8c\uff0c\u9000\u51faMySQL\u4e26\u91cd\u555f\u670d\u52d9\uff1a<\/li>\n<pre><code>exit<\/code><\/pre>\n<pre><code>sudo systemctl start mysql<\/code><\/pre>\n<\/ol>\n<h3 id=\"postgresql-wGEmxOZtvr\">PostgreSQL<\/h3>\n<p>\u5c0d\u65bcPostgreSQL\uff0c\u91cd\u7f6e\u5bc6\u78bc\u7684\u6b65\u9a5f\u5982\u4e0b\uff1a<\/p>\n<ol>\n<li>\u9996\u5148\uff0c\u4ee5\u8d85\u7d1a\u7528\u6236\u8eab\u4efd\u767b\u9304\u5230PostgreSQL\uff1a<\/li>\n<pre><code>sudo -u postgres psql<\/code><\/pre>\n<li>\u7136\u5f8c\uff0c\u57f7\u884c\u4ee5\u4e0b\u8a9e\u53e5\u4f86\u66f4\u6539\u7528\u6236\u5bc6\u78bc\uff1a<\/li>\n<pre><code>ALTER USER \u7528\u6236\u540d WITH PASSWORD '\u65b0\u5bc6\u78bc';<\/code><\/pre>\n<li>\u6700\u5f8c\uff0c\u9000\u51faPostgreSQL\uff1a<\/li>\n<pre><code> q<\/code><\/pre>\n<\/ol>\n<h3 id=\"sql-server-wGEmxOZtvr\">SQL Server<\/h3>\n<p>\u5728SQL Server\u4e2d\uff0c\u91cd\u7f6e\u5bc6\u78bc\u7684\u904e\u7a0b\u5982\u4e0b\uff1a<\/p>\n<ol>\n<li>\u9996\u5148\uff0c\u4f7f\u7528SQL Server Management Studio (SSMS) \u9023\u63a5\u5230\u6578\u64da\u5eab\u3002<\/li>\n<li>\u5728\u5c0d\u8c61\u8cc7\u6e90\u7ba1\u7406\u5668\u4e2d\uff0c\u627e\u5230\u9700\u8981\u91cd\u7f6e\u5bc6\u78bc\u7684\u7528\u6236\uff0c\u53f3\u9375\u9ede\u64ca\u4e26\u9078\u64c7\u201c\u5c6c\u6027\u201d\u3002<\/li>\n<li>\u5728\u201c\u5b89\u5168\u6027\u201d\u9078\u9805\u5361\u4e2d\uff0c\u8f38\u5165\u65b0\u7684\u5bc6\u78bc\u4e26\u78ba\u8a8d\u3002<\/li>\n<li>\u9ede\u64ca\u201c\u78ba\u5b9a\u201d\u4ee5\u4fdd\u5b58\u66f4\u6539\u3002<\/li>\n<\/ol>\n<h2 id=\"%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85-wGEmxOZtvr\">\u6ce8\u610f\u4e8b\u9805<\/h2>\n<p>\u5728\u91cd\u7f6e\u6578\u64da\u5eab\u5bc6\u78bc\u6642\uff0c\u61c9\u6ce8\u610f\u4ee5\u4e0b\u5e7e\u9ede\uff1a<\/p>\n<ul>\n<li>\u78ba\u4fdd\u65b0\u5bc6\u78bc\u7684\u5f37\u5ea6\uff0c\u5efa\u8b70\u4f7f\u7528\u5305\u542b\u5b57\u6bcd\u3001\u6578\u5b57\u548c\u7279\u6b8a\u5b57\u7b26\u7684\u7d44\u5408\u3002<\/li>\n<li>\u5728\u91cd\u7f6e\u5bc6\u78bc\u5f8c\uff0c\u6aa2\u67e5\u61c9\u7528\u7a0b\u5e8f\u548c\u670d\u52d9\u7684\u9023\u63a5\u914d\u7f6e\uff0c\u78ba\u4fdd\u5b83\u5011\u4f7f\u7528\u7684\u662f\u6700\u65b0\u7684\u5bc6\u78bc\u3002<\/li>\n<li>\u5b9a\u671f\u5099\u4efd\u6578\u64da\u5eab\uff0c\u4ee5\u9632\u6b62\u56e0\u5bc6\u78bc\u554f\u984c\u5c0e\u81f4\u7684\u6578\u64da\u4e1f\u5931\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-wGEmxOZtvr\">\u7e3d\u7d50<\/h2>\n<p>\u6578\u64da\u5eab\u5bc6\u78bc\u7684\u91cd\u7f6e\u662f\u4e00\u9805\u91cd\u8981\u7684\u5b89\u5168\u63aa\u65bd\uff0c\u80fd\u6709\u6548\u4fdd\u8b77\u6578\u64da\u7684\u5b89\u5168\u6027\u3002\u7121\u8ad6\u662fMySQL\u3001PostgreSQL\u9084\u662fSQL Server\uff0c\u91cd\u7f6e\u5bc6\u78bc\u7684\u904e\u7a0b\u90fd\u76f8\u5c0d\u7c21\u55ae\uff0c\u4f46\u7528\u6236\u61c9\u8b39\u614e\u64cd\u4f5c\uff0c\u78ba\u4fdd\u65b0\u5bc6\u78bc\u7684\u5b89\u5168\u6027\u548c\u5f37\u5ea6\u3002\u82e5\u60a8\u9700\u8981\u9032\u4e00\u6b65\u4e86\u89e3\u5982\u4f55\u7ba1\u7406\u60a8\u7684\u6578\u64da\u5eab\u6216\u5c0b\u627e\u5408\u9069\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u89e3\u6c7a\u65b9\u6848\uff0c\u8acb\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u4ee5\u7372\u53d6\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8a73\u89e3\u6578\u64da\u5eab\u5bc6\u78bc\u91cd\u7f6e\u65b9\u6cd5\uff0c\u63d0\u4f9b\u5404\u7a2e\u6578\u64da\u5eab\u6539\u5bc6\u78bc\u8a9e\u53e5\uff0c\u52a9\u60a8\u8f15\u9b06\u7ba1\u7406\u6578\u64da\u5b89\u5168\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-186906","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/186906","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=186906"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/186906\/revisions"}],"predecessor-version":[{"id":186907,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/186906\/revisions\/186907"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=186906"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=186906"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=186906"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}