{"id":180930,"date":"2024-11-09T14:22:18","date_gmt":"2024-11-09T06:22:18","guid":{"rendered":"https:\/\/server.hk\/cnblog\/180930\/"},"modified":"2024-11-09T14:22:19","modified_gmt":"2024-11-09T06:22:19","slug":"%e6%b7%b1%e5%85%a5%e4%ba%86%e8%a7%a3%e6%95%b8%e6%93%9a%e5%ba%ab%e4%b8%ad%e9%95%b7%e5%ad%97%e7%ac%a6%e4%b8%b2%e9%a1%9e%e5%9e%8b%e7%9a%84%e4%bd%bf%e7%94%a8%e6%96%b9%e6%b3%95-%e6%95%b8%e6%93%9a%e5%ba%ab","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/180930\/","title":{"rendered":"\u6df1\u5165\u4e86\u89e3\u6578\u64da\u5eab\u4e2d\u9577\u5b57\u7b26\u4e32\u985e\u578b\u7684\u4f7f\u7528\u65b9\u6cd5 (\u6578\u64da\u5eab \u9577\u5b57\u7b26\u4e32 \u985e\u578b)"},"content":{"rendered":"<h1 id=\"%e6%b7%b1%e5%85%a5%e4%ba%86%e8%a7%a3%e6%95%b8%e6%93%9a%e5%ba%ab%e4%b8%ad%e9%95%b7%e5%ad%97%e7%ac%a6%e4%b8%b2%e9%a1%9e%e5%9e%8b%e7%9a%84%e4%bd%bf%e7%94%a8%e6%96%b9%e6%b3%95-nwJTsLMLng\">\u6df1\u5165\u4e86\u89e3\u6578\u64da\u5eab\u4e2d\u9577\u5b57\u7b26\u4e32\u985e\u578b\u7684\u4f7f\u7528\u65b9\u6cd5<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u6578\u64da\u9a45\u52d5\u6642\u4ee3\uff0c\u6578\u64da\u5eab\u7684\u8a2d\u8a08\u548c\u7ba1\u7406\u8b8a\u5f97\u8d8a\u4f86\u8d8a\u91cd\u8981\u3002\u7279\u5225\u662f\u5728\u8655\u7406\u9577\u5b57\u7b26\u4e32\u6578\u64da\u6642\uff0c\u9078\u64c7\u5408\u9069\u7684\u6578\u64da\u985e\u578b\u5c0d\u65bc\u6027\u80fd\u548c\u5b58\u5132\u6548\u7387\u81f3\u95dc\u91cd\u8981\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0e\u6578\u64da\u5eab\u4e2d\u9577\u5b57\u7b26\u4e32\u985e\u578b\u7684\u4f7f\u7528\u65b9\u6cd5\uff0c\u4e26\u63d0\u4f9b\u4e00\u4e9b\u5be6\u7528\u7684\u793a\u4f8b\u548c\u5efa\u8b70\u3002<\/p>\n<h2 id=\"%e9%95%b7%e5%ad%97%e7%ac%a6%e4%b8%b2%e9%a1%9e%e5%9e%8b%e7%9a%84%e5%ae%9a%e7%be%a9-nwJTsLMLng\">\u9577\u5b57\u7b26\u4e32\u985e\u578b\u7684\u5b9a\u7fa9<\/h2>\n<p>\u9577\u5b57\u7b26\u4e32\u985e\u578b\u901a\u5e38\u7528\u65bc\u5b58\u5132\u8d85\u904e\u6a19\u6e96\u5b57\u7b26\u4e32\u9577\u5ea6\u7684\u6578\u64da\u3002\u5728\u4e0d\u540c\u7684\u6578\u64da\u5eab\u7cfb\u7d71\u4e2d\uff0c\u9577\u5b57\u7b26\u4e32\u985e\u578b\u7684\u540d\u7a31\u548c\u5be6\u73fe\u53ef\u80fd\u6703\u6709\u6240\u4e0d\u540c\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u898b\u7684\u9577\u5b57\u7b26\u4e32\u985e\u578b\uff1a<\/p>\n<ul>\n<li><strong>MySQL:<\/strong> <code>TEXT<\/code>\u3001<code>MEDIUMTEXT<\/code>\u3001<code>LONGTEXT<\/code><\/li>\n<li><strong>PostgreSQL:<\/strong> <code>TEXT<\/code><\/li>\n<li><strong>SQL Server:<\/strong> <code>VARCHAR(MAX)<\/code>\u3001<code>NVARCHAR(MAX)<\/code><\/li>\n<li><strong>Oracle:<\/strong> <code>CLOB<\/code><\/li>\n<\/ul>\n<h2 id=\"%e9%95%b7%e5%ad%97%e7%ac%a6%e4%b8%b2%e9%a1%9e%e5%9e%8b%e7%9a%84%e9%81%b8%e6%93%87-nwJTsLMLng\">\u9577\u5b57\u7b26\u4e32\u985e\u578b\u7684\u9078\u64c7<\/h2>\n<p>\u5728\u9078\u64c7\u9577\u5b57\u7b26\u4e32\u985e\u578b\u6642\uff0c\u958b\u767c\u8005\u9700\u8981\u8003\u616e\u4ee5\u4e0b\u5e7e\u500b\u56e0\u7d20\uff1a<\/p>\n<ul>\n<li><strong>\u6578\u64da\u5927\u5c0f\uff1a<\/strong>\u6839\u64da\u9810\u671f\u5b58\u5132\u7684\u6578\u64da\u5927\u5c0f\u9078\u64c7\u5408\u9069\u7684\u985e\u578b\u3002\u4f8b\u5982\uff0c<code>TEXT<\/code>\u985e\u578b\u5728MySQL\u4e2d\u6700\u591a\u53ef\u4ee5\u5b58\u513265,535\u500b\u5b57\u7b26\uff0c\u800c<code>LONGTEXT<\/code>\u5247\u53ef\u4ee5\u5b58\u5132\u591a\u90544GB\u7684\u6578\u64da\u3002<\/li>\n<li><strong>\u5b57\u7b26\u96c6\uff1a<\/strong>\u78ba\u4fdd\u9078\u64c7\u7684\u985e\u578b\u652f\u6301\u6240\u9700\u7684\u5b57\u7b26\u96c6\uff0c\u7279\u5225\u662f\u5728\u8655\u7406\u591a\u8a9e\u8a00\u6578\u64da\u6642\u3002<\/li>\n<li><strong>\u6027\u80fd\u8003\u91cf\uff1a<\/strong>\u9577\u5b57\u7b26\u4e32\u985e\u578b\u7684\u67e5\u8a62\u548c\u64cd\u4f5c\u53ef\u80fd\u6703\u5f71\u97ff\u6027\u80fd\uff0c\u56e0\u6b64\u5728\u8a2d\u8a08\u6578\u64da\u5eab\u6642\u9700\u8981\u9032\u884c\u6027\u80fd\u6e2c\u8a66\u3002<\/li>\n<\/ul>\n<h2 id=\"%e9%95%b7%e5%ad%97%e7%ac%a6%e4%b8%b2%e7%9a%84%e4%bd%bf%e7%94%a8%e7%a4%ba%e4%be%8b-nwJTsLMLng\">\u9577\u5b57\u7b26\u4e32\u7684\u4f7f\u7528\u793a\u4f8b<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u4f7f\u7528\u9577\u5b57\u7b26\u4e32\u985e\u578b\u7684\u5be6\u969b\u793a\u4f8b\uff1a<\/p>\n<h3 id=\"mysql%e4%b8%ad%e7%9a%84%e9%95%b7%e5%ad%97%e7%ac%a6%e4%b8%b2-nwJTsLMLng\">MySQL\u4e2d\u7684\u9577\u5b57\u7b26\u4e32<\/h3>\n<pre><code>CREATE TABLE articles (\n    id INT AUTO_INCREMENT PRIMARY KEY,\n    title VARCHAR(255) NOT NULL,\n    content LONGTEXT NOT NULL\n);<\/code><\/pre>\n<p>\u5728\u9019\u500b\u793a\u4f8b\u4e2d\uff0c\u6211\u5011\u5275\u5efa\u4e86\u4e00\u500b\u540d\u70ba<code>articles<\/code>\u7684\u8868\uff0c\u5176\u4e2d<code>content<\/code>\u5b57\u6bb5\u4f7f\u7528<code>LONGTEXT<\/code>\u985e\u578b\u4f86\u5b58\u5132\u6587\u7ae0\u5167\u5bb9\uff0c\u9019\u6a23\u53ef\u4ee5\u8655\u7406\u975e\u5e38\u9577\u7684\u6587\u672c\u3002<\/p>\n<h3 id=\"postgresql%e4%b8%ad%e7%9a%84%e9%95%b7%e5%ad%97%e7%ac%a6%e4%b8%b2-nwJTsLMLng\">PostgreSQL\u4e2d\u7684\u9577\u5b57\u7b26\u4e32<\/h3>\n<pre><code>CREATE TABLE comments (\n    id SERIAL PRIMARY KEY,\n    post_id INT NOT NULL,\n    comment TEXT NOT NULL\n);<\/code><\/pre>\n<p>\u5728PostgreSQL\u4e2d\uff0c\u6211\u5011\u4f7f\u7528<code>TEXT<\/code>\u985e\u578b\u4f86\u5b58\u5132\u7528\u6236\u8a55\u8ad6\uff0c\u9019\u6a23\u53ef\u4ee5\u9748\u6d3b\u5730\u8655\u7406\u4e0d\u540c\u9577\u5ea6\u7684\u8a55\u8ad6\u3002<\/p>\n<h2 id=\"%e9%95%b7%e5%ad%97%e7%ac%a6%e4%b8%b2%e7%9a%84%e6%80%a7%e8%83%bd%e5%84%aa%e5%8c%96-nwJTsLMLng\">\u9577\u5b57\u7b26\u4e32\u7684\u6027\u80fd\u512a\u5316<\/h2>\n<p>\u5118\u7ba1\u9577\u5b57\u7b26\u4e32\u985e\u578b\u63d0\u4f9b\u4e86\u9748\u6d3b\u6027\uff0c\u4f46\u5728\u6027\u80fd\u65b9\u9762\u4ecd\u9700\u8b39\u614e\u8003\u616e\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u512a\u5316\u5efa\u8b70\uff1a<\/p>\n<ul>\n<li><strong>\u7d22\u5f15\uff1a<\/strong>\u5c0d\u9577\u5b57\u7b26\u4e32\u5b57\u6bb5\u9032\u884c\u7d22\u5f15\u53ef\u80fd\u6703\u5f71\u97ff\u6027\u80fd\uff0c\u56e0\u6b64\u61c9\u8b39\u614e\u4f7f\u7528\u3002\u53ef\u4ee5\u8003\u616e\u5c0d\u77ed\u5b57\u7b26\u4e32\u5b57\u6bb5\u9032\u884c\u7d22\u5f15\uff0c\u4e26\u5728\u67e5\u8a62\u4e2d\u4f7f\u7528\u5b83\u5011\u4f86\u904e\u6ffe\u6578\u64da\u3002<\/li>\n<li><strong>\u5206\u9801\u67e5\u8a62\uff1a<\/strong>\u5728\u8655\u7406\u5927\u91cf\u9577\u5b57\u7b26\u4e32\u6578\u64da\u6642\uff0c\u4f7f\u7528\u5206\u9801\u67e5\u8a62\u53ef\u4ee5\u6e1b\u5c11\u4e00\u6b21\u6027\u52a0\u8f09\u7684\u6578\u64da\u91cf\uff0c\u63d0\u9ad8\u6027\u80fd\u3002<\/li>\n<li><strong>\u6578\u64da\u58d3\u7e2e\uff1a<\/strong>\u67d0\u4e9b\u6578\u64da\u5eab\u7cfb\u7d71\u652f\u6301\u5c0d\u9577\u5b57\u7b26\u4e32\u9032\u884c\u58d3\u7e2e\uff0c\u9019\u53ef\u4ee5\u7bc0\u7701\u5b58\u5132\u7a7a\u9593\u4e26\u63d0\u9ad8I\/O\u6027\u80fd\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b5%90%e8%ab%96-nwJTsLMLng\">\u7d50\u8ad6<\/h2>\n<p>\u9577\u5b57\u7b26\u4e32\u985e\u578b\u5728\u6578\u64da\u5eab\u8a2d\u8a08\u4e2d\u626e\u6f14\u8457\u91cd\u8981\u89d2\u8272\uff0c\u6b63\u78ba\u7684\u9078\u64c7\u548c\u4f7f\u7528\u53ef\u4ee5\u986f\u8457\u63d0\u9ad8\u61c9\u7528\u7a0b\u5e8f\u7684\u6027\u80fd\u548c\u53ef\u64f4\u5c55\u6027\u3002\u7121\u8ad6\u662f\u8655\u7406\u7528\u6236\u751f\u6210\u7684\u5167\u5bb9\u9084\u662f\u5b58\u5132\u5927\u578b\u6587\u6a94\uff0c\u4e86\u89e3\u4e0d\u540c\u6578\u64da\u5eab\u7cfb\u7d71\u4e2d\u7684\u9577\u5b57\u7b26\u4e32\u985e\u578b\u53ca\u5176\u7279\u6027\u90fd\u662f\u81f3\u95dc\u91cd\u8981\u7684\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u9ad8\u6548\u7684\u6578\u64da\u5eab\u89e3\u6c7a\u65b9\u6848\uff0c\u8003\u616e\u4f7f\u7528<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u4f86\u652f\u6301\u60a8\u7684\u61c9\u7528\u7a0b\u5e8f\uff0c\u7121\u8ad6\u662f\u6578\u64da\u5b58\u5132\u9084\u662f\u8655\u7406\u9700\u6c42\uff0cServer.HK\u90fd\u80fd\u63d0\u4f9b\u7a69\u5b9a\u7684\u670d\u52d9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6df1\u5165\u4e86\u89e3\u6578\u64da\u5eab\u4e2d\u9577\u5b57\u7b26\u4e32\u985e\u578b\u7684\u4f7f\u7528\u65b9\u6cd5\uff0c\u638c\u63e1\u5176\u7279\u6027\u3001\u61c9\u7528\u5834\u666f\u53ca\u6700\u4f73\u5be6\u8e10\uff0c\u63d0\u5347\u6578\u64da\u7ba1\u7406\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-180930","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/180930","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=180930"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/180930\/revisions"}],"predecessor-version":[{"id":180931,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/180930\/revisions\/180931"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=180930"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=180930"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=180930"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}