{"id":171121,"date":"2024-11-07T00:06:25","date_gmt":"2024-11-06T16:06:25","guid":{"rendered":"https:\/\/server.hk\/cnblog\/171121\/"},"modified":"2024-11-07T00:06:26","modified_gmt":"2024-11-06T16:06:26","slug":"%e4%b8%83%e5%91%a8%e4%b8%83%e6%95%b8%e6%93%9a%e5%ba%ab%ef%bc%9a%e4%b8%80%e6%ac%a1%e6%80%a7%e4%b8%8b%e8%bc%89%e4%b8%83%e7%a8%ae%e6%95%b8%e6%93%9a%e5%ba%ab%ef%bc%8c%e5%8a%a9%e4%bd%a0%e6%88%90%e7%82%ba","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/171121\/","title":{"rendered":"\u4e03\u5468\u4e03\u6578\u64da\u5eab\uff1a\u4e00\u6b21\u6027\u4e0b\u8f09\u4e03\u7a2e\u6578\u64da\u5eab\uff0c\u52a9\u4f60\u6210\u70ba\u6578\u64da\u5eab\u5c08\u5bb6 (\u4e03\u5468\u4e03\u6578\u64da\u5eab \u4e0b\u8f09)"},"content":{"rendered":"<h1 id=\"%e4%b8%83%e5%91%a8%e4%b8%83%e6%95%b8%e6%93%9a%e5%ba%ab%ef%bc%9a%e4%b8%80%e6%ac%a1%e6%80%a7%e4%b8%8b%e8%bc%89%e4%b8%83%e7%a8%ae%e6%95%b8%e6%93%9a%e5%ba%ab%ef%bc%8c%e5%8a%a9%e4%bd%a0%e6%88%90%e7%82%ba-lCRYtbFOCU\">\u4e03\u5468\u4e03\u6578\u64da\u5eab\uff1a\u4e00\u6b21\u6027\u4e0b\u8f09\u4e03\u7a2e\u6578\u64da\u5eab\uff0c\u52a9\u4f60\u6210\u70ba\u6578\u64da\u5eab\u5c08\u5bb6<\/h1>\n<p>\u5728\u7576\u4eca\u6578\u64da\u9a45\u52d5\u7684\u4e16\u754c\u4e2d\uff0c\u6578\u64da\u5eab\u7684\u7ba1\u7406\u548c\u4f7f\u7528\u8b8a\u5f97\u8d8a\u4f86\u8d8a\u91cd\u8981\u3002\u7121\u8ad6\u662f\u4f01\u696d\u9084\u662f\u500b\u4eba\u958b\u767c\u8005\uff0c\u638c\u63e1\u591a\u7a2e\u6578\u64da\u5eab\u6280\u8853\u90fd\u80fd\u986f\u8457\u63d0\u5347\u5de5\u4f5c\u6548\u7387\u548c\u6578\u64da\u8655\u7406\u80fd\u529b\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u300c\u4e03\u5468\u4e03\u6578\u64da\u5eab\u300d\u7684\u6982\u5ff5\uff0c\u4e26\u63d0\u4f9b\u4e03\u7a2e\u6d41\u884c\u6578\u64da\u5eab\u7684\u4e0b\u8f09\u8cc7\u6e90\uff0c\u5e6b\u52a9\u4f60\u5728\u77ed\u6642\u9593\u5167\u6210\u70ba\u6578\u64da\u5eab\u5c08\u5bb6\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af%e4%b8%83%e5%91%a8%e4%b8%83%e6%95%b8%e6%93%9a%e5%ba%ab%ef%bc%9f-lCRYtbFOCU\">\u4ec0\u9ebc\u662f\u4e03\u5468\u4e03\u6578\u64da\u5eab\uff1f<\/h2>\n<p>\u4e03\u5468\u4e03\u6578\u64da\u5eab\u662f\u4e00\u500b\u5b78\u7fd2\u8a08\u5283\uff0c\u65e8\u5728\u5e6b\u52a9\u5b78\u7fd2\u8005\u5728\u4e03\u5468\u5167\u638c\u63e1\u4e03\u7a2e\u4e0d\u540c\u7684\u6578\u64da\u5eab\u6280\u8853\u3002\u9019\u500b\u8a08\u5283\u4e0d\u50c5\u9069\u5408\u521d\u5b78\u8005\uff0c\u4e5f\u9069\u5408\u5e0c\u671b\u64f4\u5c55\u6280\u80fd\u7684\u958b\u767c\u8005\u3002\u6bcf\u5468\u5c08\u6ce8\u65bc\u4e00\u7a2e\u6578\u64da\u5eab\uff0c\u901a\u904e\u5be6\u8e10\u548c\u7406\u8ad6\u76f8\u7d50\u5408\u7684\u65b9\u5f0f\uff0c\u6df1\u5165\u7406\u89e3\u5176\u7279\u6027\u548c\u61c9\u7528\u5834\u666f\u3002<\/p>\n<h2 id=\"%e4%b8%83%e7%a8%ae%e6%95%b8%e6%93%9a%e5%ba%ab%e4%bb%8b%e7%b4%b9-lCRYtbFOCU\">\u4e03\u7a2e\u6578\u64da\u5eab\u4ecb\u7d39<\/h2>\n<ul>\n<li>\n<h3 id=\"1-mysql-lCRYtbFOCU\">1. MySQL<\/h3>\n<\/li>\n<p>MySQL \u662f\u4e00\u7a2e\u958b\u6e90\u7684\u95dc\u806f\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u5ee3\u6cdb\u61c9\u7528\u65bc\u7db2\u7ad9\u548c\u61c9\u7528\u7a0b\u5e8f\u4e2d\u3002\u5b83\u4ee5\u5176\u9ad8\u6548\u6027\u548c\u7a69\u5b9a\u6027\u8457\u7a31\uff0c\u4e26\u4e14\u64c1\u6709\u5f37\u5927\u7684\u793e\u5340\u652f\u6301\u3002<\/p>\n<pre><code>-- \u5275\u5efa\u4e00\u500b\u6578\u64da\u5eab\nCREATE DATABASE my_database;\n\n-- \u5275\u5efa\u4e00\u500b\u8868\nCREATE TABLE users (\n    id INT AUTO_INCREMENT PRIMARY KEY,\n    name VARCHAR(100),\n    email VARCHAR(100)\n);<\/code><\/pre>\n<li>\n<h3 id=\"2-postgresql-lCRYtbFOCU\">2. PostgreSQL<\/h3>\n<\/li>\n<p>PostgreSQL \u662f\u4e00\u500b\u529f\u80fd\u5f37\u5927\u7684\u958b\u6e90\u5c0d\u8c61\u95dc\u806f\u6578\u64da\u5eab\u7cfb\u7d71\uff0c\u652f\u6301\u591a\u7a2e\u6578\u64da\u985e\u578b\u548c\u64f4\u5c55\u3002\u5b83\u7279\u5225\u9069\u5408\u9700\u8981\u8907\u96dc\u67e5\u8a62\u548c\u6578\u64da\u5b8c\u6574\u6027\u7684\u61c9\u7528\u3002<\/p>\n<pre><code>-- \u5275\u5efa\u4e00\u500b\u8868\nCREATE TABLE products (\n    id SERIAL PRIMARY KEY,\n    name TEXT,\n    price NUMERIC\n);<\/code><\/pre>\n<li>\n<h3 id=\"3-mongodb-lCRYtbFOCU\">3. MongoDB<\/h3>\n<\/li>\n<p>MongoDB \u662f\u4e00\u7a2e NoSQL \u6578\u64da\u5eab\uff0c\u4f7f\u7528\u6587\u6a94\u5c0e\u5411\u7684\u6578\u64da\u6a21\u578b\uff0c\u9069\u5408\u8655\u7406\u5927\u898f\u6a21\u7684\u975e\u7d50\u69cb\u5316\u6578\u64da\u3002\u5b83\u7684\u9748\u6d3b\u6027\u4f7f\u5f97\u958b\u767c\u8005\u80fd\u5920\u5feb\u901f\u8fed\u4ee3\u3002<\/p>\n<pre><code>{ \"name\": \"John\", \"age\": 30, \"city\": \"New York\" }<\/code><\/pre>\n<li>\n<h3 id=\"4-sqlite-lCRYtbFOCU\">4. SQLite<\/h3>\n<\/li>\n<p>SQLite \u662f\u4e00\u500b\u8f15\u91cf\u7d1a\u7684\u95dc\u806f\u6578\u64da\u5eab\uff0c\u9069\u5408\u5d4c\u5165\u5f0f\u61c9\u7528\u548c\u5c0f\u578b\u9805\u76ee\u3002\u5b83\u7684\u7c21\u55ae\u6027\u548c\u7121\u9700\u914d\u7f6e\u7684\u7279\u6027\u4f7f\u5176\u6210\u70ba\u958b\u767c\u8005\u7684\u71b1\u9580\u9078\u64c7\u3002<\/p>\n<pre><code>-- \u5275\u5efa\u4e00\u500b\u8868\nCREATE TABLE notes (\n    id INTEGER PRIMARY KEY,\n    content TEXT\n);<\/code><\/pre>\n<li>\n<h3 id=\"5-redis-lCRYtbFOCU\">5. Redis<\/h3>\n<\/li>\n<p>Redis \u662f\u4e00\u500b\u9ad8\u6027\u80fd\u7684\u9375\u503c\u5b58\u5132\u7cfb\u7d71\uff0c\u5e38\u7528\u65bc\u7de9\u5b58\u548c\u5373\u6642\u6578\u64da\u8655\u7406\u3002\u5b83\u652f\u6301\u591a\u7a2e\u6578\u64da\u7d50\u69cb\uff0c\u5982\u5b57\u7b26\u4e32\u3001\u54c8\u5e0c\u3001\u5217\u8868\u7b49\u3002<\/p>\n<pre><code>SET key \"value\"<\/code><\/pre>\n<li>\n<h3 id=\"6-cassandra-lCRYtbFOCU\">6. Cassandra<\/h3>\n<\/li>\n<p>Cassandra \u662f\u4e00\u500b\u5206\u4f48\u5f0f NoSQL \u6578\u64da\u5eab\uff0c\u8a2d\u8a08\u7528\u65bc\u8655\u7406\u5927\u91cf\u6578\u64da\u4e26\u63d0\u4f9b\u9ad8\u53ef\u7528\u6027\u3002\u5b83\u9069\u5408\u9700\u8981\u9ad8\u5beb\u5165\u541e\u5410\u91cf\u7684\u61c9\u7528\u3002<\/p>\n<pre><code>CREATE TABLE users (\n    user_id UUID PRIMARY KEY,\n    name TEXT,\n    email TEXT\n);<\/code><\/pre>\n<li>\n<h3 id=\"7-mariadb-lCRYtbFOCU\">7. MariaDB<\/h3>\n<\/li>\n<p>MariaDB \u662f MySQL \u7684\u4e00\u500b\u5206\u652f\uff0c\u63d0\u4f9b\u4e86\u66f4\u9ad8\u7684\u6027\u80fd\u548c\u5b89\u5168\u6027\u3002\u5b83\u517c\u5bb9 MySQL\uff0c\u4e26\u4e14\u64c1\u6709\u66f4\u591a\u7684\u5b58\u5132\u5f15\u64ce\u9078\u64c7\u3002<\/p>\n<pre><code>CREATE TABLE orders (\n    order_id INT AUTO_INCREMENT PRIMARY KEY,\n    user_id INT,\n    amount DECIMAL(10, 2)\n);<\/code><\/pre>\n<\/ul>\n<h2 id=\"%e5%a6%82%e4%bd%95%e4%b8%8b%e8%bc%89%e9%80%99%e4%ba%9b%e6%95%b8%e6%93%9a%e5%ba%ab%ef%bc%9f-lCRYtbFOCU\">\u5982\u4f55\u4e0b\u8f09\u9019\u4e9b\u6578\u64da\u5eab\uff1f<\/h2>\n<p>\u6bcf\u7a2e\u6578\u64da\u5eab\u90fd\u6709\u5176\u5b98\u65b9\u7db2\u7ad9\uff0c\u63d0\u4f9b\u4e0b\u8f09\u548c\u5b89\u88dd\u6307\u5357\u3002\u4ee5\u4e0b\u662f\u5404\u6578\u64da\u5eab\u7684\u4e0b\u8f09\u93c8\u63a5\uff1a<\/p>\n<ul>\n<li><a href=\"https:\/\/www.mysql.com\/downloads\/\" rel=\"nofollow noopener\" target=\"_blank\">MySQL<\/a><\/li>\n<li><a href=\"https:\/\/www.postgresql.org\/download\/\" rel=\"nofollow noopener\" target=\"_blank\">PostgreSQL<\/a><\/li>\n<li><a href=\"https:\/\/www.mongodb.com\/try\/download\/community\" rel=\"nofollow noopener\" target=\"_blank\">MongoDB<\/a><\/li>\n<li><a href=\"https:\/\/www.sqlite.org\/download.html\" rel=\"nofollow noopener\" target=\"_blank\">SQLite<\/a><\/li>\n<li><a href=\"https:\/\/redis.io\/download\" rel=\"nofollow noopener\" target=\"_blank\">Redis<\/a><\/li>\n<li><a href=\"http:\/\/cassandra.apache.org\/download\/\" rel=\"nofollow noopener\" target=\"_blank\">Cassandra<\/a><\/li>\n<li><a href=\"https:\/\/mariadb.org\/download\/\" rel=\"nofollow noopener\" target=\"_blank\">MariaDB<\/a><\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-lCRYtbFOCU\">\u7e3d\u7d50<\/h2>\n<p>\u901a\u904e\u300c\u4e03\u5468\u4e03\u6578\u64da\u5eab\u300d\u7684\u5b78\u7fd2\u8a08\u5283\uff0c\u4f60\u53ef\u4ee5\u5728\u77ed\u6642\u9593\u5167\u638c\u63e1\u591a\u7a2e\u6578\u64da\u5eab\u6280\u8853\uff0c\u63d0\u5347\u81ea\u5df1\u7684\u5c08\u696d\u80fd\u529b\u3002\u7121\u8ad6\u4f60\u662f\u60f3\u8981\u5728\u4f01\u696d\u4e2d\u61c9\u7528\u9019\u4e9b\u6280\u8853\uff0c\u9084\u662f\u5e0c\u671b\u5728\u500b\u4eba\u9805\u76ee\u4e2d\u4f7f\u7528\uff0c\u9019\u4e9b\u6578\u64da\u5eab\u90fd\u80fd\u70ba\u4f60\u63d0\u4f9b\u5f37\u5927\u7684\u652f\u6301\u3002\u5982\u679c\u4f60\u9700\u8981\u7a69\u5b9a\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u4f86\u9032\u884c\u6578\u64da\u5eab\u7684\u5be6\u9a57\u548c\u958b\u767c\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u6eff\u8db3\u4e0d\u540c\u9700\u6c42\u7684\u7528\u6236\u3002\u63a2\u7d22\u66f4\u591a\u95dc\u65bc <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u7684\u8cc7\u8a0a\uff0c\u52a9\u4f60\u5728\u6578\u64da\u5eab\u7ba1\u7406\u7684\u9053\u8def\u4e0a\u66f4\u9032\u4e00\u6b65\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u6b21\u6027\u4e0b\u8f09\u4e03\u7a2e\u6578\u64da\u5eab\uff0c\u52a9\u4f60\u5728\u4e03\u5468\u5167\u638c\u63e1\u6578\u64da\u5eab\u6280\u80fd\uff0c\u6210\u70ba\u6578\u64da\u5eab\u5c08\u5bb6\uff0c\u63d0\u5347\u8077\u696d\u7af6\u722d\u529b\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-171121","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/171121","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=171121"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/171121\/revisions"}],"predecessor-version":[{"id":171122,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/171121\/revisions\/171122"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=171121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=171121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=171121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}