{"id":1135,"date":"2017-01-08T21:54:46","date_gmt":"2017-01-08T13:54:46","guid":{"rendered":"http:\/\/blog.amjet.biz\/IT\/?p=1135"},"modified":"2017-01-16T16:47:34","modified_gmt":"2017-01-16T08:47:34","slug":"mariadb-%e8%b3%87%e6%96%99%e5%ba%ab%e7%b7%a8%e7%a2%bc%e5%95%8f%e9%a1%8c","status":"publish","type":"post","link":"https:\/\/blog.amjet.biz\/IT\/?p=1135","title":{"rendered":"MariaDB \u8cc7\u6599\u5eab\u7de8\u78bc\u554f\u984c"},"content":{"rendered":"<p>\u5982\u679c\u5beb\u5165\u8cc7\u6599\u5eab\u51fa\u73fe\u985e\u4f3c\u4ee5\u4e0b\u932f\u8aa4<\/p>\n<p>org.mariadb.jdbc.internal.util.dao.QueryException: Incorrect string value: &#8216;\\xE8\\x87\\xBA\\xE5\\x8C\\x97&#8230;&#8217; for column<\/p>\n<p>\u5148\u6aa2\u67e5\u8cc7\u6599\u5eab\u7684\u7de8\u78bc\u8a2d\u5b9a\uff0c\u4f8b\u5982\u8cc7\u6599\u5eab\u540d\u7a31\u70ba mydb<\/p>\n<p>mysql mydb<\/p>\n<p>show variables like &#8216;char%&#8217;;<\/p>\n<p>character_set_database \u7684\u8a2d\u5b9a\u53ef\u80fd\u662f\u9810\u8a2d\u503c\u00a0latin1 \u8207\u4f60\u7684\u8cc7\u6599\u7de8\u78bc\u4e0d\u4e00\u81f4\uff0c\u56e0\u800c\u51fa\u73fe\u4e0a\u8ff0\u554f\u984c<\/p>\n<p>\u5efa\u6c7a\u65b9\u6cd5\u662f\u5c07\u8cc7\u6599\u5eab drop \u6389\u7528\u4ee5\u4e0b\u6307\u4ee4\u5728\u5efa\u7acb\u8cc7\u6599\u5eab\u6642\u6307\u5b9a\u7de8\u78bc\uff0c\u4f8b\u5982<\/p>\n<p>create database mydb character set &#8216;utf8&#8217;<\/p>\n<p>\u9019\u6642\u5019\u518d\u6aa2\u67e5\u4e00\u6b21\u00a0character_set_database \u61c9\u8a72\u662f\u986f\u793a utf8\uff0c\u5f8c\u7e8c\u5efa\u7acb\u7684 table \u4e5f\u90fd\u6703\u63a1\u7528\u9019\u500b\u7de8\u78bc<\/p>\n<p>\u9644\u8a3b:<\/p>\n<p>\u6aa2\u67e5\u8cc7\u6599\u5eab\u5167 table \u7de8\u78bc\u53ef\u4ee5\u7528 show table status<\/p>\n<p>\u6aa2\u67e5 table \u5167\u6b04\u4f4d\u7de8\u78bc\u53ef\u4ee5\u7528 show full columns from &lt;your table&gt;<\/p>\n<p>CentOS 7 \u8a2d\u5b9a character_set_server \u5247\u662f\u5728 \/etc\/my.cnf.d\/server.cnf \u7684 server section \u52a0\u4e00\u884c<\/p>\n<p>character_set_server=utf8<\/p>\n<p>[ratings]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u679c\u5beb\u5165\u8cc7\u6599\u5eab\u51fa\u73fe\u985e\u4f3c\u4ee5\u4e0b\u932f\u8aa4 org.mariadb.jdbc.internal.util.dao.QueryException: Incorrect string value: &#8216;\\xE8\\x87\\xBA\\xE5\\x8C\\x97&#8230;&#8217; for column \u5148\u6aa2\u67e5\u8cc7\u6599\u5eab\u7684\u7de8\u78bc\u8a2d\u5b9a\uff0c\u4f8b\u5982\u8cc7\u6599\u5eab\u540d\u7a31\u70ba mydb mysql mydb show variables like &#8216;char%&#8217;; character_set_database \u7684\u8a2d\u5b9a\u53ef\u80fd\u662f\u9810\u8a2d\u503c\u00a0latin1 \u8207\u4f60\u7684\u8cc7\u6599\u7de8\u78bc\u4e0d\u4e00\u81f4\uff0c\u56e0\u800c\u51fa\u73fe\u4e0a\u8ff0\u554f\u984c \u5efa\u6c7a\u65b9\u6cd5\u662f\u5c07\u8cc7\u6599\u5eab drop \u6389\u7528\u4ee5\u4e0b\u6307\u4ee4\u5728\u5efa\u7acb\u8cc7\u6599\u5eab\u6642\u6307\u5b9a\u7de8\u78bc\uff0c\u4f8b\u5982 create database mydb character set &#8216;utf8&#8217; \u9019\u6642\u5019\u518d\u6aa2\u67e5\u4e00\u6b21\u00a0character_set_database \u61c9\u8a72\u662f\u986f\u793a utf8\uff0c\u5f8c\u7e8c\u5efa\u7acb\u7684 table \u4e5f\u90fd\u6703\u63a1\u7528\u9019\u500b\u7de8\u78bc \u9644\u8a3b: \u6aa2\u67e5\u8cc7\u6599\u5eab\u5167 table \u7de8\u78bc\u53ef\u4ee5\u7528 show table status \u6aa2\u67e5 table \u5167\u6b04\u4f4d\u7de8\u78bc\u53ef\u4ee5\u7528 show full columns from &lt;your table&gt; CentOS 7 \u8a2d\u5b9a character_set_server \u5247\u662f\u5728 \/etc\/my.cnf.d\/server.cnf [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[148],"tags":[149],"class_list":["post-1135","post","type-post","status-publish","format-standard","hentry","category-database","tag-mariadb"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts\/1135","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1135"}],"version-history":[{"count":4,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts\/1135\/revisions"}],"predecessor-version":[{"id":1147,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts\/1135\/revisions\/1147"}],"wp:attachment":[{"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}