{"id":186600,"date":"2024-11-11T07:16:25","date_gmt":"2024-11-10T23:16:25","guid":{"rendered":"https:\/\/server.hk\/cnblog\/186600\/"},"modified":"2024-11-11T07:16:26","modified_gmt":"2024-11-10T23:16:26","slug":"%e6%95%b8%e6%93%9a%e5%ba%ab%e7%ae%a1%e7%90%86%e5%bf%85%e5%82%99%ef%bc%9a%e5%af%a6%e7%94%a8%e8%a6%96%e9%a0%bb%e6%95%99%e7%a8%8b-%e6%95%b8%e6%93%9a%e5%ba%ab%e9%81%8b%e7%b6%ad%e8%a6%96%e9%a0%bb%e6%95%99","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/186600\/","title":{"rendered":"\u6578\u64da\u5eab\u7ba1\u7406\u5fc5\u5099\uff1a\u5be6\u7528\u8996\u983b\u6559\u7a0b (\u6578\u64da\u5eab\u904b\u7dad\u8996\u983b\u6559\u7a0b)"},"content":{"rendered":"<h1 id=\"%e6%95%b8%e6%93%9a%e5%ba%ab%e7%ae%a1%e7%90%86%e5%bf%85%e5%82%99%ef%bc%9a%e5%af%a6%e7%94%a8%e8%a6%96%e9%a0%bb%e6%95%99%e7%a8%8b-%e6%95%b8%e6%93%9a%e5%ba%ab%e9%81%8b%e7%b6%ad%e8%a6%96%e9%a0%bb%e6%95%99-hfrugzPwBz\">\u6578\u64da\u5eab\u7ba1\u7406\u5fc5\u5099\uff1a\u5be6\u7528\u8996\u983b\u6559\u7a0b (\u6578\u64da\u5eab\u904b\u7dad\u8996\u983b\u6559\u7a0b)<\/h1>\n<p>\u5728\u7576\u4eca\u6578\u64da\u9a45\u52d5\u7684\u4e16\u754c\u4e2d\uff0c\u6578\u64da\u5eab\u7ba1\u7406\u6210\u70ba\u4e86\u4f01\u696d\u904b\u71df\u4e2d\u4e0d\u53ef\u6216\u7f3a\u7684\u4e00\u90e8\u5206\u3002\u7121\u8ad6\u662f\u5c0f\u578b\u521d\u5275\u516c\u53f8\u9084\u662f\u5927\u578b\u4f01\u696d\uff0c\u6578\u64da\u5eab\u7684\u6709\u6548\u7ba1\u7406\u90fd\u80fd\u76f4\u63a5\u5f71\u97ff\u5230\u696d\u52d9\u7684\u6548\u7387\u548c\u6c7a\u7b56\u7684\u6e96\u78ba\u6027\u3002\u96a8\u8457\u6280\u8853\u7684\u9032\u6b65\uff0c\u8d8a\u4f86\u8d8a\u591a\u7684\u5b78\u7fd2\u8cc7\u6e90\u51fa\u73fe\uff0c\u5176\u4e2d\u8996\u983b\u6559\u7a0b\u56e0\u5176\u76f4\u89c0\u6027\u548c\u6613\u65bc\u7406\u89e3\u7684\u7279\u9ede\u800c\u53d7\u5230\u5ee3\u6cdb\u6b61\u8fce\u3002\u672c\u6587\u5c07\u63a2\u8a0e\u6578\u64da\u5eab\u7ba1\u7406\u7684\u57fa\u672c\u6982\u5ff5\u53ca\u5176\u76f8\u95dc\u7684\u5be6\u7528\u8996\u983b\u6559\u7a0b\u3002<\/p>\n<h2 id=\"%e6%95%b8%e6%93%9a%e5%ba%ab%e7%ae%a1%e7%90%86%e7%9a%84%e5%9f%ba%e6%9c%ac%e6%a6%82%e5%bf%b5-hfrugzPwBz\">\u6578\u64da\u5eab\u7ba1\u7406\u7684\u57fa\u672c\u6982\u5ff5<\/h2>\n<p>\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff08DBMS\uff09\u662f\u4e00\u7a2e\u8edf\u4ef6\u7cfb\u7d71\uff0c\u7528\u65bc\u5275\u5efa\u3001\u7ba1\u7406\u548c\u64cd\u4f5c\u6578\u64da\u5eab\u3002\u5b83\u63d0\u4f9b\u4e86\u4e00\u500b\u7528\u6236\u754c\u9762\uff0c\u4f7f\u7528\u6236\u80fd\u5920\u8f15\u9b06\u5730\u9032\u884c\u6578\u64da\u7684\u5b58\u53d6\u548c\u7ba1\u7406\u3002\u6578\u64da\u5eab\u7ba1\u7406\u7684\u4e3b\u8981\u4efb\u52d9\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u6578\u64da\u7684\u5b58\u5132\u8207\u6aa2\u7d22<\/li>\n<li>\u6578\u64da\u7684\u5b89\u5168\u6027\u8207\u5b8c\u6574\u6027<\/li>\n<li>\u6578\u64da\u7684\u5099\u4efd\u8207\u6062\u5fa9<\/li>\n<li>\u6027\u80fd\u7684\u512a\u5316<\/li>\n<\/ul>\n<p>\u96a8\u8457\u6578\u64da\u91cf\u7684\u589e\u9577\uff0c\u6578\u64da\u5eab\u7684\u904b\u7dad\u5de5\u4f5c\u8b8a\u5f97\u8d8a\u4f86\u8d8a\u8907\u96dc\uff0c\u56e0\u6b64\u5b78\u7fd2\u76f8\u95dc\u7684\u6280\u80fd\u548c\u77e5\u8b58\u8b8a\u5f97\u5c24\u70ba\u91cd\u8981\u3002<\/p>\n<h2 id=\"%e7%82%ba%e4%bb%80%e9%ba%bc%e9%81%b8%e6%93%87%e8%a6%96%e9%a0%bb%e6%95%99%e7%a8%8b%ef%bc%9f-hfrugzPwBz\">\u70ba\u4ec0\u9ebc\u9078\u64c7\u8996\u983b\u6559\u7a0b\uff1f<\/h2>\n<p>\u8996\u983b\u6559\u7a0b\u63d0\u4f9b\u4e86\u4e00\u7a2e\u8996\u89ba\u5316\u7684\u5b78\u7fd2\u65b9\u5f0f\uff0c\u80fd\u5920\u5e6b\u52a9\u5b78\u7fd2\u8005\u66f4\u597d\u5730\u7406\u89e3\u8907\u96dc\u7684\u6982\u5ff5\u548c\u64cd\u4f5c\u3002\u4ee5\u4e0b\u662f\u8996\u983b\u6559\u7a0b\u7684\u4e00\u4e9b\u512a\u52e2\uff1a<\/p>\n<ul>\n<li><strong>\u76f4\u89c0\u6027\uff1a<\/strong>\u8996\u983b\u80fd\u5920\u5c55\u793a\u5be6\u969b\u64cd\u4f5c\u904e\u7a0b\uff0c\u8b93\u5b78\u7fd2\u8005\u66f4\u5bb9\u6613\u638c\u63e1\u6280\u80fd\u3002<\/li>\n<li><strong>\u9748\u6d3b\u6027\uff1a<\/strong>\u5b78\u7fd2\u8005\u53ef\u4ee5\u6839\u64da\u81ea\u5df1\u7684\u6642\u9593\u5b89\u6392\u9032\u884c\u5b78\u7fd2\uff0c\u96a8\u6642\u56de\u653e\u91cd\u9ede\u5167\u5bb9\u3002<\/li>\n<li><strong>\u4e92\u52d5\u6027\uff1a<\/strong>\u8a31\u591a\u8996\u983b\u6559\u7a0b\u63d0\u4f9b\u4e86\u4e92\u52d5\u74b0\u7bc0\uff0c\u5b78\u7fd2\u8005\u53ef\u4ee5\u5728\u793e\u5340\u4e2d\u63d0\u554f\u548c\u4ea4\u6d41\u3002<\/li>\n<\/ul>\n<h2 id=\"%e6%8e%a8%e8%96%a6%e7%9a%84%e6%95%b8%e6%93%9a%e5%ba%ab%e9%81%8b%e7%b6%ad%e8%a6%96%e9%a0%bb%e6%95%99%e7%a8%8b-hfrugzPwBz\">\u63a8\u85a6\u7684\u6578\u64da\u5eab\u904b\u7dad\u8996\u983b\u6559\u7a0b<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u53d7\u6b61\u8fce\u7684\u6578\u64da\u5eab\u904b\u7dad\u8996\u983b\u6559\u7a0b\uff0c\u9069\u5408\u4e0d\u540c\u5c64\u6b21\u7684\u5b78\u7fd2\u8005\uff1a<\/p>\n<h3 id=\"1-mysql-%e6%95%b8%e6%93%9a%e5%ba%ab%e7%ae%a1%e7%90%86-hfrugzPwBz\">1. MySQL \u6578\u64da\u5eab\u7ba1\u7406<\/h3>\n<p>MySQL \u662f\u6700\u6d41\u884c\u7684\u958b\u6e90\u6578\u64da\u5eab\u4e4b\u4e00\uff0c\u9069\u5408\u521d\u5b78\u8005\u548c\u4e2d\u7d1a\u7528\u6236\u3002\u8a31\u591a\u5728\u7dda\u5e73\u53f0\u63d0\u4f9b MySQL \u7684\u8996\u983b\u6559\u7a0b\uff0c\u6db5\u84cb\u5f9e\u5b89\u88dd\u5230\u9ad8\u7d1a\u67e5\u8a62\u7684\u5404\u500b\u65b9\u9762\u3002<\/p>\n<pre><code>-- \u5275\u5efa\u6578\u64da\u5eab\nCREATE DATABASE my_database;\n\n-- \u5275\u5efa\u8868\nCREATE TABLE users (\n    id INT AUTO_INCREMENT PRIMARY KEY,\n    name VARCHAR(100),\n    email VARCHAR(100)\n);\n<\/code><\/pre>\n<h3 id=\"2-postgresql-%e6%95%b8%e6%93%9a%e5%ba%ab%e7%ae%a1%e7%90%86-hfrugzPwBz\">2. PostgreSQL \u6578\u64da\u5eab\u7ba1\u7406<\/h3>\n<p>PostgreSQL \u662f\u4e00\u500b\u529f\u80fd\u5f37\u5927\u7684\u958b\u6e90\u6578\u64da\u5eab\uff0c\u9069\u5408\u9700\u8981\u9ad8\u6027\u80fd\u548c\u9ad8\u53ef\u64f4\u5c55\u6027\u7684\u61c9\u7528\u3002\u8996\u983b\u6559\u7a0b\u901a\u5e38\u6703\u4ecb\u7d39\u5982\u4f55\u9032\u884c\u6578\u64da\u5eab\u8a2d\u8a08\u3001\u6027\u80fd\u8abf\u512a\u7b49\u3002<\/p>\n<pre><code>-- \u5275\u5efa\u6578\u64da\u5eab\nCREATE DATABASE my_database;\n\n-- \u5275\u5efa\u8868\nCREATE TABLE users (\n    id SERIAL PRIMARY KEY,\n    name VARCHAR(100),\n    email VARCHAR(100)\n);\n<\/code><\/pre>\n<h3 id=\"3-mongodb-%e6%95%b8%e6%93%9a%e5%ba%ab%e7%ae%a1%e7%90%86-hfrugzPwBz\">3. MongoDB \u6578\u64da\u5eab\u7ba1\u7406<\/h3>\n<p>MongoDB \u662f\u4e00\u7a2e NoSQL \u6578\u64da\u5eab\uff0c\u9069\u5408\u8655\u7406\u975e\u7d50\u69cb\u5316\u6578\u64da\u3002\u8996\u983b\u6559\u7a0b\u6703\u4ecb\u7d39\u5982\u4f55\u4f7f\u7528 MongoDB \u9032\u884c\u6578\u64da\u5b58\u5132\u548c\u67e5\u8a62\u3002<\/p>\n<pre><code>\/\/ \u63d2\u5165\u6578\u64da\ndb.users.insertOne({ name: \"John Doe\", email: \"john@example.com\" });\n\n\/\/ \u67e5\u8a62\u6578\u64da\ndb.users.find({ name: \"John Doe\" });\n<\/code><\/pre>\n<h2 id=\"%e7%b5%90%e8%ab%96-hfrugzPwBz\">\u7d50\u8ad6<\/h2>\n<p>\u6578\u64da\u5eab\u7ba1\u7406\u662f\u73fe\u4ee3\u4f01\u696d\u904b\u71df\u4e2d\u81f3\u95dc\u91cd\u8981\u7684\u4e00\u74b0\uff0c\u638c\u63e1\u76f8\u95dc\u6280\u80fd\u80fd\u5920\u986f\u8457\u63d0\u9ad8\u5de5\u4f5c\u6548\u7387\u3002\u8996\u983b\u6559\u7a0b\u4f5c\u70ba\u4e00\u7a2e\u6709\u6548\u7684\u5b78\u7fd2\u5de5\u5177\uff0c\u80fd\u5920\u5e6b\u52a9\u5b78\u7fd2\u8005\u5feb\u901f\u638c\u63e1\u6578\u64da\u5eab\u904b\u7dad\u7684\u57fa\u672c\u77e5\u8b58\u548c\u6280\u80fd\u3002\u7121\u8ad6\u662f\u9078\u64c7 MySQL\u3001PostgreSQL \u9084\u662f MongoDB\uff0c\u9069\u5408\u81ea\u5df1\u7684\u5b78\u7fd2\u8cc7\u6e90\u90fd\u80fd\u70ba\u672a\u4f86\u7684\u8077\u696d\u767c\u5c55\u6253\u4e0b\u5805\u5be6\u7684\u57fa\u790e\u3002<\/p>\n<p>\u5982\u679c\u60a8\u5c0d\u65bc\u6578\u64da\u5eab\u7ba1\u7406\u6709\u9032\u4e00\u6b65\u7684\u9700\u6c42\uff0c\u6216\u8005\u60f3\u8981\u4e86\u89e3\u66f4\u591a\u95dc\u65bc <a href=\"https:\/\/server.hk\">VPS<\/a> \u548c <a href=\"https:\/\/server.hk\">\u9999\u6e2f\u4f3a\u670d\u5668<\/a> \u7684\u8cc7\u8a0a\uff0c\u6b61\u8fce\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u638c\u63e1\u6578\u64da\u5eab\u7ba1\u7406\u7684\u5fc5\u5099\u6280\u80fd\uff0c\u900f\u904e\u5be6\u7528\u8996\u983b\u6559\u7a0b\u5b78\u7fd2\u6578\u64da\u5eab\u904b\u7dad\uff0c\u63d0\u5347\u4f60\u7684\u5c08\u696d\u80fd\u529b\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-186600","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/186600","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=186600"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/186600\/revisions"}],"predecessor-version":[{"id":186601,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/186600\/revisions\/186601"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=186600"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=186600"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=186600"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}