{"id":172629,"date":"2024-11-07T14:43:18","date_gmt":"2024-11-07T06:43:18","guid":{"rendered":"https:\/\/server.hk\/cnblog\/172629\/"},"modified":"2024-11-07T14:43:19","modified_gmt":"2024-11-07T06:43:19","slug":"%e5%a6%82%e4%bd%95%e6%9f%a5%e7%9c%8b%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e5%ad%97%e7%ac%a6%e9%9b%86%ef%bc%9f-%e6%9f%a5%e7%9c%8b%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e5%ad%97%e7%ac%a6%e9%9b%86","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/172629\/","title":{"rendered":"\u5982\u4f55\u67e5\u770b\u6578\u64da\u5eab\u7684\u5b57\u7b26\u96c6\uff1f (\u67e5\u770b\u6578\u64da\u5eab\u7684\u5b57\u7b26\u96c6)"},"content":{"rendered":"<h1 id=\"%e5%a6%82%e4%bd%95%e6%9f%a5%e7%9c%8b%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e5%ad%97%e7%ac%a6%e9%9b%86%ef%bc%9f-KWtCfHktEk\">\u5982\u4f55\u67e5\u770b\u6578\u64da\u5eab\u7684\u5b57\u7b26\u96c6\uff1f<\/h1>\n<p>\u5728\u6578\u64da\u5eab\u7ba1\u7406\u4e2d\uff0c\u5b57\u7b26\u96c6\u7684\u9078\u64c7\u5c0d\u65bc\u6578\u64da\u7684\u5b58\u5132\u548c\u986f\u793a\u81f3\u95dc\u91cd\u8981\u3002\u5b57\u7b26\u96c6\u6c7a\u5b9a\u4e86\u6578\u64da\u5eab\u5982\u4f55\u89e3\u91cb\u548c\u5b58\u5132\u5b57\u7b26\uff0c\u7279\u5225\u662f\u5728\u8655\u7406\u591a\u8a9e\u8a00\u5167\u5bb9\u6642\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u67e5\u770b\u6578\u64da\u5eab\u7684\u5b57\u7b26\u96c6\uff0c\u4e26\u63d0\u4f9b\u4e00\u4e9b\u5be6\u7528\u7684\u793a\u4f8b\u548c\u6b65\u9a5f\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af%e5%ad%97%e7%ac%a6%e9%9b%86%ef%bc%9f-KWtCfHktEk\">\u4ec0\u9ebc\u662f\u5b57\u7b26\u96c6\uff1f<\/h2>\n<p>\u5b57\u7b26\u96c6\u662f\u4e00\u7d44\u5b57\u7b26\u7684\u96c6\u5408\uff0c\u9019\u4e9b\u5b57\u7b26\u53ef\u4ee5\u7528\u4f86\u8868\u793a\u6587\u672c\u3002\u6bcf\u500b\u5b57\u7b26\u96c6\u90fd\u6709\u5176\u7279\u5b9a\u7684\u7de8\u78bc\u65b9\u5f0f\uff0c\u9019\u5f71\u97ff\u5230\u6578\u64da\u7684\u5b58\u5132\u548c\u6aa2\u7d22\u3002\u4f8b\u5982\uff0cUTF-8\u662f\u4e00\u7a2e\u5e38\u7528\u7684\u5b57\u7b26\u96c6\uff0c\u80fd\u5920\u652f\u6301\u591a\u7a2e\u8a9e\u8a00\u7684\u5b57\u7b26\uff0c\u800cLatin1\u5247\u4e3b\u8981\u7528\u65bc\u897f\u6b50\u8a9e\u8a00\u3002<\/p>\n<h2 id=\"%e7%82%ba%e4%bb%80%e9%ba%bc%e9%9c%80%e8%a6%81%e6%9f%a5%e7%9c%8b%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e5%ad%97%e7%ac%a6%e9%9b%86%ef%bc%9f-KWtCfHktEk\">\u70ba\u4ec0\u9ebc\u9700\u8981\u67e5\u770b\u6578\u64da\u5eab\u7684\u5b57\u7b26\u96c6\uff1f<\/h2>\n<p>\u67e5\u770b\u6578\u64da\u5eab\u7684\u5b57\u7b26\u96c6\u662f\u78ba\u4fdd\u6578\u64da\u6b63\u78ba\u5b58\u5132\u548c\u986f\u793a\u7684\u95dc\u9375\u6b65\u9a5f\u3002\u82e5\u5b57\u7b26\u96c6\u4e0d\u5339\u914d\uff0c\u53ef\u80fd\u6703\u5c0e\u81f4\u6578\u64da\u640d\u58de\u6216\u986f\u793a\u932f\u8aa4\u3002\u4f8b\u5982\uff0c\u7576\u4e00\u500b\u4f7f\u7528UTF-8\u5b57\u7b26\u96c6\u7684\u6578\u64da\u5eab\u63a5\u6536\u5230Latin1\u7de8\u78bc\u7684\u6578\u64da\u6642\uff0c\u53ef\u80fd\u6703\u51fa\u73fe\u4e82\u78bc\u73fe\u8c61\u3002\u56e0\u6b64\uff0c\u4e86\u89e3\u6578\u64da\u5eab\u7684\u5b57\u7b26\u96c6\u53ef\u4ee5\u5e6b\u52a9\u958b\u767c\u8005\u548c\u6578\u64da\u5eab\u7ba1\u7406\u54e1\u907f\u514d\u9019\u4e9b\u554f\u984c\u3002<\/p>\n<h2 id=\"%e5%a6%82%e4%bd%95%e6%9f%a5%e7%9c%8b%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e5%ad%97%e7%ac%a6%e9%9b%86%ef%bc%9f-KWtCfHktEk\">\u5982\u4f55\u67e5\u770b\u6578\u64da\u5eab\u7684\u5b57\u7b26\u96c6\uff1f<\/h2>\n<p>\u4ee5\u4e0b\u662f\u67e5\u770b\u4e0d\u540c\u985e\u578b\u6578\u64da\u5eab\u5b57\u7b26\u96c6\u7684\u6b65\u9a5f\uff1a<\/p>\n<h3 id=\"1-mysql%e6%95%b8%e6%93%9a%e5%ba%ab-KWtCfHktEk\">1. MySQL\u6578\u64da\u5eab<\/h3>\n<p>\u5728MySQL\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0bSQL\u67e5\u8a62\u4f86\u67e5\u770b\u6578\u64da\u5eab\u7684\u5b57\u7b26\u96c6\uff1a<\/p>\n<pre><code>SHOW VARIABLES LIKE 'character_set_database';<\/code><\/pre>\n<p>\u9019\u5c07\u8fd4\u56de\u7576\u524d\u6578\u64da\u5eab\u7684\u5b57\u7b26\u96c6\u3002\u4f8b\u5982\uff0c\u5982\u679c\u8fd4\u56de\u503c\u662futf8mb4\uff0c\u5247\u8868\u793a\u8a72\u6578\u64da\u5eab\u4f7f\u7528UTF-8\u7de8\u78bc\u3002<\/p>\n<p>\u6b64\u5916\uff0c\u60a8\u9084\u53ef\u4ee5\u67e5\u770b\u7279\u5b9a\u8868\u7684\u5b57\u7b26\u96c6\uff1a<\/p>\n<pre><code>SHOW TABLE STATUS FROM your_database_name;<\/code><\/pre>\n<p>\u9019\u5c07\u986f\u793a\u6240\u6709\u8868\u7684\u5b57\u7b26\u96c6\u548c\u6392\u5e8f\u898f\u5247\u3002<\/p>\n<h3 id=\"2-postgresql%e6%95%b8%e6%93%9a%e5%ba%ab-KWtCfHktEk\">2. PostgreSQL\u6578\u64da\u5eab<\/h3>\n<p>\u5728PostgreSQL\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u67e5\u8a62\u4f86\u67e5\u770b\u6578\u64da\u5eab\u7684\u5b57\u7b26\u96c6\uff1a<\/p>\n<pre><code>SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname = 'your_database_name';<\/code><\/pre>\n<p>\u9019\u5c07\u8fd4\u56de\u6578\u64da\u5eab\u7684\u7de8\u78bc\u683c\u5f0f\uff0c\u4f8b\u5982UTF8\u3002<\/p>\n<h3 id=\"3-sql-server%e6%95%b8%e6%93%9a%e5%ba%ab-KWtCfHktEk\">3. SQL Server\u6578\u64da\u5eab<\/h3>\n<p>\u5728SQL Server\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u67e5\u8a62\u4f86\u67e5\u770b\u6578\u64da\u5eab\u7684\u5b57\u7b26\u96c6\uff1a<\/p>\n<pre><code>SELECT collation_name FROM sys.databases WHERE name = 'your_database_name';<\/code><\/pre>\n<p>\u9019\u5c07\u8fd4\u56de\u6578\u64da\u5eab\u7684\u6392\u5e8f\u898f\u5247\uff0c\u5f9e\u4e2d\u53ef\u4ee5\u63a8\u65b7\u51fa\u5b57\u7b26\u96c6\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-KWtCfHktEk\">\u7e3d\u7d50<\/h2>\n<p>\u4e86\u89e3\u5982\u4f55\u67e5\u770b\u6578\u64da\u5eab\u7684\u5b57\u7b26\u96c6\u5c0d\u65bc\u78ba\u4fdd\u6578\u64da\u7684\u6b63\u78ba\u6027\u548c\u5b8c\u6574\u6027\u81f3\u95dc\u91cd\u8981\u3002\u7121\u8ad6\u662f\u4f7f\u7528MySQL\u3001PostgreSQL\u9084\u662fSQL Server\uff0c\u638c\u63e1\u76f8\u61c9\u7684\u67e5\u8a62\u8a9e\u53e5\u90fd\u80fd\u5e6b\u52a9\u60a8\u5feb\u901f\u7372\u53d6\u6240\u9700\u7684\u4fe1\u606f\u3002\u82e5\u60a8\u9700\u8981\u9032\u4e00\u6b65\u7684\u6578\u64da\u5eab\u7ba1\u7406\u6216\u76f8\u95dc\u670d\u52d9\uff0c\u8acb\u8003\u616e\u4f7f\u7528<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u89e3\u6c7a\u65b9\u6848\uff0c\u9019\u5c07\u70ba\u60a8\u7684\u696d\u52d9\u63d0\u4f9b\u7a69\u5b9a\u7684\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3\u5982\u4f55\u67e5\u770b\u6578\u64da\u5eab\u7684\u5b57\u7b26\u96c6\uff0c\u78ba\u4fdd\u6578\u64da\u6b63\u78ba\u986f\u793a\u548c\u5b58\u5132\uff0c\u63d0\u5347\u6578\u64da\u5eab\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-172629","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/172629","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=172629"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/172629\/revisions"}],"predecessor-version":[{"id":172630,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/172629\/revisions\/172630"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=172629"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=172629"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=172629"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}