{"id":62,"date":"2023-02-10T18:03:32","date_gmt":"2023-02-10T10:03:32","guid":{"rendered":"https:\/\/solost.cn\/?p=62"},"modified":"2023-02-10T18:03:32","modified_gmt":"2023-02-10T10:03:32","slug":"147","status":"publish","type":"post","link":"https:\/\/solost.cn\/?p=62","title":{"rendered":"typecho\u4fee\u590dDatabase Query Error\u6216\u65e0\u6cd5\u4f7f\u7528emoji"},"content":{"rendered":"<p>\u8bb0\u5f97\u4f7f\u7528\u6570\u636e\u5e93\u524d\u8981\u628a\u6570\u636e\u5e93\u7f16\u7801\u6539\u6210<code>utf8mb4<\/code>\uff0c\u5efa\u8bae\u5148\u5907\u4efd\u6570\u636e\u5e93\u7136\u540e\u76f4\u63a5\u91cd\u5efa\u4e00\u4e2a<code>utf8mb4<\/code>\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u5bfc\u5165\uff0c\u628a\u6839\u76ee\u5f55\u7684<code>config.inc.php<\/code>\u76f8\u5173\u6587\u4ef6\u6539\u4e00\u4e0b\u5c31\u597d\u3002\u7136\u540e\u6267\u884c\u8fd9\u4e9b\u64cd\u4f5c<\/p>\n<pre><code>alter table typecho_comments convert to character set utf8mb4 collate utf8mb4_unicode_ci;\nalter table typecho_contents convert to character set utf8mb4 collate utf8mb4_unicode_ci;\nalter table typecho_fields convert to character set utf8mb4 collate utf8mb4_unicode_ci;\nalter table typecho_metas convert to character set utf8mb4 collate utf8mb4_unicode_ci;\nalter table typecho_options convert to character set utf8mb4 collate utf8mb4_unicode_ci;\nalter table typecho_relationships convert to character set utf8mb4 collate utf8mb4_unicode_ci;\nalter table typecho_users convert to character set utf8mb4 collate utf8mb4_unicode_ci;<\/code><\/pre>\n<p>\u6267\u884c\u4e0a\u8ff0sql\u8bed\u53e5\u6765\u4fee\u6539\u8868\u7684\u7f16\u7801\uff0c\u5982\u679c\u7528\u7684\u662f\u5b9d\u5854\u9762\u677f\u548cMySQL\u6570\u636e\u5e93\uff0c\u4e00\u822c\u6709\u53ef\u89c6\u5316\u7684phpmyadmin\u754c\u9762\uff0c\u53ef\u4ee5\u5728phpmyadmin\u7684\u63a7\u5236\u53f0\u91cc\u9762\u6267\u884c\u4e0a\u9762\u7684\u8bed\u53e5\uff0c\u5982\u679c\u662f\u670d\u52a1\u5668\u53ef\u4ee5\u5728\u670d\u52a1\u5668\u4e0a\u8fde\u63a5mysql\u540e\u6267\u884c\u3002\u6700\u540e\u5c06 Typecho \u76ee\u5f55\u4e0b\u7684config.inc.php \u914d\u7f6e\u6587\u4ef6\u4e2d\u6570\u636e\u5e93\u5b9a\u4e49\u53c2\u6570\u4e2d\u7684 charset \u4e3a <code>utf8mb4<\/code>\uff1a<\/p>\n<pre><code>$db-&gt;addServer(array (\n&#039;host&#039;      =&gt;  localhost,\n&#039;user&#039;      =&gt;  &#039;root&#039;,\n&#039;password&#039;  =&gt;  &#039;root&#039;,\n&#039;charset&#039;   =&gt;  &#039;utf8mb4&#039;, \/\/\u4fee\u6539\u8fd9\u4e00\u884c\n&#039;port&#039;      =&gt;  3306,\n&#039;database&#039;  =&gt;  &#039;&#039;\n), Typecho_Db::READ | Typecho_Db::WRITE);<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u8bb0\u5f97\u4f7f\u7528\u6570\u636e\u5e93\u524d\u8981\u628a\u6570\u636e\u5e93\u7f16\u7801\u6539\u6210utf8mb4\uff0c\u5efa\u8bae\u5148\u5907\u4efd\u6570\u636e\u5e93\u7136\u540e\u76f4\u63a5\u91cd\u5efa\u4e00\u4e2autf8mb4\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u5bfc\u5165\uff0c\u628a\u6839\u76ee\u5f55\u7684config.inc.php\u76f8\u5173\u6587\u4ef6\u6539\u4e00\u4e0b\u5c31\u597d\u3002\u7136\u540e\u6267\u884c\u8fd9\u4e9b\u64cd\u4f5c alter table typecho_comments convert to character set utf8mb4 collate utf8mb4_unicode_ci; alter table typecho_contents convert to character set utf8mb4 collate utf8mb4_unicode_ci; alter table typecho_fields convert to character set utf8mb4 collate utf8mb4_unicode_ci; alter table typecho_metas convert to character set utf8mb4 collate utf8mb4_unicode_ci; alter table typecho_options convert to character set utf8mb4 collate utf8mb4_unicode_ci; alter table typecho_relationships convert [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[21],"class_list":["post-62","post","type-post","status-publish","format-standard","hentry","category-typecho","tag-typecho"],"_links":{"self":[{"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/posts\/62","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/solost.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=62"}],"version-history":[{"count":0,"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/posts\/62\/revisions"}],"wp:attachment":[{"href":"https:\/\/solost.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=62"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/solost.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=62"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/solost.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=62"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}