{"id":728,"date":"2015-06-01T14:42:44","date_gmt":"2015-06-01T06:42:44","guid":{"rendered":"https:\/\/ai.zhousir.top\/?p=728"},"modified":"2026-08-18T12:09:34","modified_gmt":"2026-08-18T04:09:34","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":"<section id=\"wenyan\" style=\"font-family: system-ui, 'Apple Color Emoji', 'Segoe UI', 'Segoe UI Symbol', 'Noto Sans', Roboto, sans-serif; line-height: 1.75; font-size: 16px; color: #000000; caret-color: #000000;\" data-provider=\"WenYan\">\n<p style=\"margin: 1em 0px;\">\u5411 MySQL \u63d2\u5165\u5e26\u4e2d\u6587\u7684\u6570\u636e\uff0c\u4f8b\u5982 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">insert into student values('\u5f20\u4e09','\u7537','2015-11-12','Sales');<\/code>\uff0c\u82e5\u51fa\u73b0\u4e71\u7801\uff0c\u5148\u7528 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">show variables like 'character%';<\/code> \u67e5\u770b\u5f53\u524d\u76f8\u5173\u5b57\u7b26\u96c6\u3002<\/p>\n<p><!--more--><\/p>\n<p style=\"margin: 1em 0px;\"><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<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e00\u3001\u516d\u5904\u5b57\u7b26\u96c6<\/h2>\n<p style=\"margin: 1em 0px;\">\u4ece\u4e0a\u56fe\u53ef\u4ee5\u770b\u5230 MySQL \u6709\u516d\u5904\u4f7f\u7528\u4e86\u5b57\u7b26\u96c6\uff1aclient\u3001connection\u3001database\u3001results\u3001server\u3001system\u3002\u5176\u4e2d database\u3001server\u3001system \u504f\u670d\u52a1\u5668\u7aef\uff08system \u65e0\u6cd5\u4fee\u6539\uff0c\u5c31\u662f utf-8\uff09\uff1bconnection\u3001client\u3001results \u4e0e\u5ba2\u6237\u7aef\u76f8\u5173\u3002<\/p>\n<table style=\"display: table; text-align: left; overflow: auto; border-collapse: collapse; margin: 1.4em auto; max-width: 100%; table-layout: fixed; overflow-wrap: break-word; word-break: break-all;\" width=\"800\">\n<thead>\n<tr>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u53d8\u91cf<\/th>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u542b\u4e49<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">client<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u5ba2\u6237\u7aef\u4f7f\u7528\u7684\u5b57\u7b26\u96c6<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">connection<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u8fde\u63a5\u6570\u636e\u5e93\u65f6\u7684\u5b57\u7b26\u96c6\uff1b\u7a0b\u5e8f\u672a\u6307\u660e\u5219\u8ddf\u670d\u52a1\u5668\u9ed8\u8ba4<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">database<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u67d0\u4e2a\u5e93\u7684\u5b57\u7b26\u96c6\uff1b\u5efa\u5e93\u672a\u6307\u660e\u5219\u7528\u5b89\u88c5\u65f6\u6307\u5b9a\u7684<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">results<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef\u65f6\u4f7f\u7528\u7684\u5b57\u7b26\u96c6<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">server<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u670d\u52a1\u5668\u5b89\u88c5\u65f6\u6307\u5b9a\u7684\u9ed8\u8ba4\u5b57\u7b26\u96c6<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">system<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u6570\u636e\u5e93\u7cfb\u7edf\u81ea\u8eab\u4f7f\u7528\u7684\u5b57\u7b26\u96c6<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e8c\u3001\u4e71\u7801\u539f\u56e0\u4e0e\u4e34\u65f6\u4fee\u590d<\/h2>\n<p style=\"margin: 1em 0px;\">\u95ee\u9898\u51fa\u5728\u5f53\u524d CMD \u7a97\u53e3\uff1a\u5ba2\u6237\u7aef\u8f93\u5165\u91c7\u7528 <strong style=\"color: #4870ac;\">GBK<\/strong>\uff0c\u6570\u636e\u5e93\u662f UTF-8\uff0c\u7f16\u7801\u4e0d\u4e00\u81f4\u5c31\u4f1a\u4e71\u7801\u3002CMD \u7f16\u7801\u4e0d\u597d\u6539\uff0c\u53ea\u80fd\u6539 connection\u3001client\u3001results\uff0c\u544a\u8bc9\u670d\u52a1\u5668\u300c\u5f53\u524d\u63d2\u5165\u7684\u662f GBK\u300d\u3002\u670d\u52a1\u5668\u5e93\u867d\u7136\u662f UTF-8\uff0c\u4f46\u80fd\u8bc6\u522b\u901a\u77e5\u8fc7\u6765\u7684 GBK \u5e76\u81ea\u52a8\u8f6c\u6210 UTF-8 \u5b58\u50a8\u3002\u5feb\u901f\u8bbe\u7f6e\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">set names gbk;<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u8bbe\u5b8c\u540e\u63d2\u5165\u548c\u663e\u793a\u90fd\u6b63\u5e38\uff0c\u4f46\u53ea\u5bf9\u5f53\u524d\u7a97\u53e3\u6709\u6548\u3002\u5173\u6389 CMD \u518d\u5f00\uff0c\u4e71\u7801\u53c8\u56de\u6765\u3002<\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e09\u3001\u6539 my.ini \u6301\u4e45\u5316<\/h2>\n<p style=\"margin: 1em 0px;\">MySQL \u5b89\u88c5\u76ee\u5f55\u4e0b\u7684 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">my.ini<\/code> \u53ef\u4ee5\u4e00\u52b3\u6c38\u9038\u3002[mysql] \u4e0e\u5ba2\u6237\u7aef\u76f8\u5173\uff0c[mysqld] \u4e0e\u670d\u52a1\u5668\u76f8\u5173\u3002\u9ed8\u8ba4\u7c7b\u4f3c\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">[mysql]\ndefault-character-set=utf8\n[mysqld]\ncharacter-set-server=utf8<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u628a\u5ba2\u6237\u7aef\u9ed8\u8ba4\u7f16\u7801 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">default-character-set=utf8<\/code> \u6539\u6210 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">default-character-set=gbk<\/code>\uff0c\u518d\u91cd\u542f MySQL \u670d\u52a1\u5373\u53ef\u3002\u8fd9\u662f\u9488\u5bf9 Windows CMD \u5ba2\u6237\u7aef\u7684\u505a\u6cd5\uff1b\u5e94\u7528\u7a0b\u5e8f\u8fde\u63a5\u5e94\u5728\u8fde\u63a5\u4e32\u6216\u9a71\u52a8\u91cc\u660e\u786e\u6307\u5b9a UTF-8\u3002<\/p>\n<blockquote style=\"display: block; font-size: 0.9em; border-left: 3px solid #4870ac; padding: 0.5em 1em; margin: 0px; background: #f6f8fa; color: #40464f;\">\n<p style=\"margin: 1em 0px;\"><strong style=\"color: #4870ac;\">\u4e00\u53e5\u8bdd\u603b\u7ed3\uff1aCMD \u662f GBK\u3001\u5e93\u662f UTF-8 \u5c31\u4f1a\u4e71\u7801\uff1bset names gbk \u7ba1\u5f53\u524d\u7a97\u53e3\uff0c\u6539 my.ini \u7684\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u624d\u80fd\u6301\u4e45\u3002<\/strong><\/p>\n<\/blockquote>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>\u5411 MySQL \u63d2\u5165\u5e26\u4e2d\u6587\u7684\u6570\u636e\uff0c\u4f8b\u5982 insert into student values(&#8216;\u5f20\u4e09&#8217;,&#8217;\u7537&#8217; [&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":[192,62,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":3,"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}]}}