{"id":728,"date":"2015-06-01T14:42:44","date_gmt":"2015-06-01T06:42:44","guid":{"rendered":"https:\/\/ai.zhousir.top\/?p=728"},"modified":"2015-06-01T14:49:15","modified_gmt":"2015-06-01T06:49:15","slug":"mysql-%e6%8f%92%e5%85%a5%e4%b8%ad%e6%96%87%e4%b9%b1%e7%a0%81%e9%97%ae%e9%a2%98%e7%9a%84%e8%a7%a3%e5%86%b3","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=728","title":{"rendered":"MySQL \u63d2\u5165\u4e2d\u6587\u4e71\u7801\u95ee\u9898\u7684\u89e3\u51b3"},"content":{"rendered":"<p>\u5f53\u5411 MySQL \u6570\u636e\u5e93\u63d2\u5165\u4e00\u6761\u5e26\u6709\u4e2d\u6587\u7684\u6570\u636e\u5f62\u5982 insert into student\u00a0values(&#8216;\u5f20\u4e09&#8217;,&#8217;\u7537&#8217;,&#8217;2015-11-12&#8242;,&#8217;Sales&#8217;);<\/p>\n<p>\u51fa\u73b0\u4e71\u7801\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u8bed\u53e5 <span style=\"color: #993300;\">show variables like &#8216;character%&#8217;;<\/span> \u6765\u67e5\u770b\u5f53\u524d\u6570\u636e\u5e93\u7684\u76f8\u5173\u7f16\u7801\u96c6\u3002<br \/>\n<!--more--><\/p>\n<p><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/06\/aaa.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-733\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/06\/aaa.png\" alt=\"aaa\" width=\"535\" height=\"228\" srcset=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/06\/aaa.png 678w, https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/06\/aaa-528x225.png 528w\" sizes=\"(max-width: 535px) 100vw, 535px\" \/><\/a><\/p>\n<p>\u4ece\u4e0a\u56fe\u4e2d\u53ef\u4ee5\u770b\u5230 MySQL \u6709\u516d\u5904\u4f7f\u7528\u4e86\u5b57\u7b26\u96c6\uff0c\u5206\u522b\u4e3a\uff1aclient \u3001connection\u3001database\u3001results\u3001server \u3001system\u3002\u5176\u4e2d\u4e0e\u670d\u52a1\u5668\u7aef\u76f8\u5173\uff1adatabase\u3001server\u3001system\uff08\u6c38\u8fdc\u65e0\u6cd5\u4fee\u6539\uff0c\u5c31\u662futf-8\uff09\uff1b\u4e0e\u5ba2\u6237\u7aef\u76f8\u5173\uff1aconnection\u3001client\u3001results \u3002<\/p>\n<div>\n<table class=\"_mce_tagged_br\" style=\"height: 167px;\" border=\"0\" width=\"534\">\n<tbody>\n<tr>\n<td><span style=\"color: #008080;\">client<\/span><\/td>\n<td><span style=\"color: #008080;\">\u4e3a\u5ba2\u6237\u7aef\u4f7f\u7528\u7684\u5b57\u7b26\u96c6\u3002<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"color: #008080;\">connection<\/span><\/td>\n<td><span style=\"color: #008080;\">\u4e3a\u8fde\u63a5\u6570\u636e\u5e93\u7684\u5b57\u7b26\u96c6\u8bbe\u7f6e\u7c7b\u578b\uff0c\u5982\u679c\u7a0b\u5e8f\u6ca1\u6709\u6307\u660e\u8fde\u63a5\u6570\u636e\u5e93\u4f7f\u7528\u7684\u5b57\u7b26\u96c6\u7c7b\u578b\u5219\u6309\u7167\u670d\u52a1\u5668\u7aef\u9ed8\u8ba4\u7684\u5b57\u7b26\u96c6\u8bbe\u7f6e\u3002<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"color: #008080;\">database<\/span><\/td>\n<td><span style=\"color: #008080;\">\u4e3a\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e2d\u67d0\u4e2a\u5e93\u4f7f\u7528\u7684\u5b57\u7b26\u96c6\u8bbe\u5b9a\uff0c\u5982\u679c\u5efa\u5e93\u65f6\u6ca1\u6709\u6307\u660e\uff0c\u5c06\u4f7f\u7528\u670d\u52a1\u5668\u5b89\u88c5\u65f6\u6307\u5b9a\u7684\u5b57\u7b26\u96c6\u8bbe\u7f6e\u3002<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"color: #008080;\">results<\/span><\/td>\n<td><span style=\"color: #008080;\">\u4e3a\u6570\u636e\u5e93\u7ed9\u5ba2\u6237\u7aef\u8fd4\u56de\u65f6\u4f7f\u7528\u7684\u5b57\u7b26\u96c6\u8bbe\u5b9a\uff0c\u5982\u679c\u6ca1\u6709\u6307\u660e\uff0c\u4f7f\u7528\u670d\u52a1\u5668\u9ed8\u8ba4\u7684\u5b57\u7b26\u96c6\u3002<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"color: #008080;\">server<\/span><\/td>\n<td><span style=\"color: #008080;\">\u4e3a\u670d\u52a1\u5668\u5b89\u88c5\u65f6\u6307\u5b9a\u7684\u9ed8\u8ba4\u5b57\u7b26\u96c6\u8bbe\u5b9a\u3002<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"color: #008080;\">system<\/span><\/td>\n<td><span style=\"color: #008080;\">\u4e3a\u6570\u636e\u5e93\u7cfb\u7edf\u4f7f\u7528\u7684\u5b57\u7b26\u96c6\u8bbe\u5b9a\u3002<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u4e86\u89e3\u4e86\u4e0a\u9762\u7684\u4fe1\u606f\u6211\u4eec\u6765\u5206\u6790\u4e0b\u4e71\u7801\u7684\u539f\u56e0\uff0c\u95ee\u9898\u51fa\u5728\u4e86\u5f53\u524d\u7684 CMD \u5ba2\u6237\u7aef\u7a97\u53e3\uff0c\u56e0\u4e3a\u5f53\u524d\u7684 CMD \u5ba2\u6237\u7aef\u8f93\u5165\u91c7\u7528 GBK \u7f16\u7801\uff0c\u800c\u6570\u636e\u5e93\u7684\u7f16\u7801\u683c\u5f0f\u4e3a UTF-8\uff0c\u7f16\u7801\u4e0d\u4e00\u81f4\u5bfc\u81f4\u4e86\u4e71\u7801\u4ea7\u751f\u3002\u800c\u5f53\u524d CMD \u5ba2\u6237\u7aef\u7684\u7f16\u7801\u683c\u5f0f\u65e0\u6cd5\u4fee\u6539\uff0c\u6240\u4ee5\u53ea\u80fd\u4fee\u6539 connection\u3001 client\u3001results \u7684\u7f16\u7801\u96c6\u6765\u544a\u77e5\u670d\u52a1\u5668\u7aef\u5f53\u524d\u63d2\u5165\u7684\u6570\u636e\u91c7\u7528 GBK \u7f16\u7801\uff0c\u800c\u670d\u52a1\u5668\u7684\u6570\u636e\u5e93\u867d\u7136\u662f\u91c7\u7528 UTF-8 \u7f16\u7801\uff0c\u4f46\u5374\u53ef\u4ee5\u8bc6\u522b\u901a\u77e5\u670d\u52a1\u5668\u7aef\u7684 GBK \u7f16\u7801\u6570\u636e\u5e76\u5c06\u5176\u81ea\u52a8\u8f6c\u6362\u4e3a UTF-8 \u8fdb\u884c\u5b58\u50a8\u3002\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u8bed\u53e5\u6765\u5feb\u901f\u8bbe\u7f6e\u4e0e\u5ba2\u6237\u7aef\u76f8\u5173\u7684\u7f16\u7801\u96c6\uff1a<br \/>\n<span style=\"color: #993300;\">set names gbk;<\/span><\/p>\n<p>\u8bbe\u7f6e\u5b8c\u6210\u540e\u5373\u53ef\u89e3\u51b3\u5ba2\u6237\u7aef\u63d2\u5165\u6570\u636e\u6216\u663e\u793a\u6570\u636e\u7684\u4e71\u7801\u95ee\u9898\u4e86\uff0c\u4f46\u6211\u4eec\u9a6c\u4e0a\u4f1a\u53d1\u73b0\u8fd9\u79cd\u5f62\u5f0f\u7684\u8bbe\u7f6e\u53ea\u4f1a\u5728\u5f53\u524d\u7a97\u53e3\u6709\u6548\uff0c\u5f53\u7a97\u53e3\u5173\u95ed\u540e\u91cd\u65b0\u6253\u5f00 CMD \u5ba2\u6237\u7aef\u7684\u65f6\u5019\u53c8\u4f1a\u51fa\u73b0\u4e71\u7801\u95ee\u9898\uff1b\u90a3\u4e48\uff0c\u5982\u4f55\u8fdb\u884c\u4e00\u4e2a\u4e00\u52b3\u6c38\u9038\u7684\u8bbe\u7f6e\u5462\uff1f\u5728 MySQL \u7684\u5b89\u88c5\u76ee\u5f55\u4e0b\u6709\u4e00\u4e2a my.ini \u914d\u7f6e\u6587\u4ef6\uff0c\u901a\u8fc7\u4fee\u6539\u8fd9\u4e2a\u914d\u7f6e\u6587\u4ef6\u53ef\u4ee5\u4e00\u52b3\u6c38\u9038\u7684\u89e3\u51b3\u4e71\u7801\u95ee\u9898\u3002\u5728\u8fd9\u4e2a\u914d\u7f6e\u6587\u4ef6\u4e2d [mysql] \u4e0e\u5ba2\u6237\u7aef\u914d\u7f6e\u76f8\u5173\uff0c[mysqld] \u4e0e\u670d\u52a1\u5668\u914d\u7f6e\u76f8\u5173\u3002\u9ed8\u8ba4\u914d\u7f6e\u5982\u4e0b\uff1a<\/p>\n<p><span style=\"color: #993300;\">[mysql]<\/span><br \/>\n<span style=\"color: #993300;\"> default-character-set=utf8<\/span><br \/>\n<span style=\"color: #993300;\"> [mysqld]<\/span><br \/>\n<span style=\"color: #993300;\"> character-set-server=utf8<\/span><br \/>\n\u8fd9\u65f6\u53ea\u9700\u8981\u5c06\u4e0b\u7684\u9ed8\u8ba4\u7f16\u7801 default-character-set=utf8 \u6539\u4e3a default-character-set=gbk \uff0c\u91cd\u65b0\u542f\u52a8 MySQL \u670d\u52a1\u5373\u53ef\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u5411 MySQL \u6570\u636e\u5e93\u63d2\u5165\u4e00\u6761\u5e26\u6709\u4e2d\u6587\u7684\u6570\u636e\u5f62\u5982 insert into student\u00a0values(&#038;# [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[61],"tags":[63],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/728"}],"collection":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=728"}],"version-history":[{"count":6,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/728\/revisions"}],"predecessor-version":[{"id":736,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/728\/revisions\/736"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=728"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=728"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=728"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}