添加链接
注册
登录
link之家
链接快照平台
输入网页链接,自动生成快照
标签化管理网页链接
相关文章推荐
活泼的针织衫
·
“井打到哪里,铁人精神就带到哪里”--党史- ...
·
3 月前
·
爱运动的热带鱼
·
开播10年了,《深夜食堂》还是这么温暖_有戏 ...
·
4 月前
·
玩足球的手术刀
·
千亿级头部券商资管“换帅”,去年以来还有多家 ...
·
4 月前
·
无邪的橡皮擦
·
[原神漫画]刻晴你在干什么啊(看评论区)长弓 ...
·
5 月前
·
胡子拉碴的卤蛋
·
孙健-全部作品在线阅读-微信读书
·
1 年前
·
link之家
›
字符集和排序规则 | PingCAP 文档中心
select
mysql排序
字符编码
tidb
https://docs.pingcap.com/zh/tidb/stable/character-set-and-collation/
体贴的板凳
1 年前
</noscript><div id="___gatsby"><div style="outline:none" tabindex="-1" id="gatsby-focus-wrapper"><style data-emotion="css 6ko3zs">.css-6ko3zs{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;width:100%;box-sizing:border-box;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;position:fixed;z-index:1100;top:0;left:auto;right:0;background-color:#1976d2;color:#fff;background-color:#f9f9f9;border-bottom:1px solid #e5e5e5;box-shadow:0px 1px 6px rgba(0, 0, 0, 0.08);height:5rem;}@media print{.css-6ko3zs{}}</style><style data-emotion="css foju0o">.css-foju0o{background-color:#fff;color:rgba(0, 0, 0, 0.87);-webkit-transition:box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;box-shadow:0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;width:100%;box-sizing:border-box;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;position:fixed;z-index:1100;top:0;left:auto;right:0;background-color:#1976d2;color:#fff;background-color:#f9f9f9;border-bottom:1px solid #e5e5e5;box-shadow:0px 1px 6px rgba(0, 0, 0, 0.08);height:5rem;}@media print{.css-foju0o{}}</style><header class="MuiPaper-root MuiPaper-elevation MuiPaper-elevation4 MuiAppBar-root MuiAppBar-colorPrimary MuiAppBar-positionFixed mui-fixed css-foju0o"><style data-emotion="css 1xw2ef0">.css-1xw2ef0{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding-left:16px;padding-right:16px;min-height:56px;height:100%;}@media (min-width:600px){.css-1xw2ef0{padding-left:24px;padding-right:24px;}}@media (min-width:0px){@media (orientation: landscape){.css-1xw2ef0{min-height:48px;}}}@media (min-width:600px){.css-1xw2ef0{min-height:64px;}}@media (min-width:900px){.css-1xw2ef0{padding-left:2rem;padding-right:2rem;}}</style><div class="MuiToolbar-root MuiToolbar-gutters MuiToolbar-regular css-1xw2ef0"><style data-emotion="css 16bbyrv">.css-16bbyrv{text-align:center;-webkit-flex:0 0 auto;-ms-flex:0 0 auto;flex:0 0 auto;font-size:1.5rem;padding:8px;border-radius:50%;overflow:visible;color:rgba(0, 0, 0, 0.54);-webkit-transition:background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;}.css-16bbyrv:hover{background-color:rgba(0, 0, 0, 0.04);}@media (hover: none){.css-16bbyrv:hover{background-color:transparent;}}.css-16bbyrv.Mui-disabled{background-color:transparent;color:rgba(0, 0, 0, 0.26);}@media (min-width:1200px){.css-16bbyrv{;}}</style><style data-emotion="css iuftj9">.css-iuftj9{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;position:relative;box-sizing:border-box;-webkit-tap-highlight-color:transparent;background-color:transparent;outline:0;border:0;margin:0;border-radius:0;padding:0;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;-moz-appearance:none;-webkit-appearance:none;-webkit-text-decoration:none;text-decoration:none;color:inherit;text-align:center;-webkit-flex:0 0 auto;-ms-flex:0 0 auto;flex:0 0 auto;font-size:1.5rem;padding:8px;border-radius:50%;overflow:visible;color:rgba(0, 0, 0, 0.54);-webkit-transition:background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;}.css-iuftj9::-moz-focus-inner{border-style:none;}.css-iuftj9.Mui-disabled{pointer-events:none;cursor:default;}@media print{.css-iuftj9{-webkit-print-color-adjust:exact;color-adjust:exact;}}.css-iuftj9:hover{background-color:rgba(0, 0, 0, 0.04);}@media (hover: none){.css-iuftj9:hover{background-color:transparent;}}.css-iuftj9.Mui-disabled{background-color:transparent;color:rgba(0, 0, 0, 0.26);}@media (min-width:1200px){.css-iuftj9{;}}</style><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeMedium css-iuftj9" tabindex="0" type="button" aria-label="menu"><style data-emotion="css vubbuv">.css-vubbuv{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:1em;height:1em;display:inline-block;fill:currentColor;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;font-size:1.5rem;}</style><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="MenuIcon"><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/></svg></button><style data-emotion="css a3xyjy">.css-a3xyjy{z-index:1200;}</style><style data-emotion="css 13tqxrv">@media (min-width:0px){.css-13tqxrv{;}}@media (min-width:900px){.css-13tqxrv{display:block;}}</style><div class="MuiBox-root css-13tqxrv"><style data-emotion="css tx8jsd">.css-tx8jsd{margin:0;font-size:1rem;line-height:1.5rem;font-family:"Helvetica Neue","sans-serif";font-weight:400;font-style:normal;color:#666666;}</style><a class="MuiTypography-root MuiTypography-body1 css-tx8jsd" target="_blank" href="https://cn.pingcap.com/" style="text-decoration:none"><style data-emotion="css uz5bjn">.css-uz5bjn{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:1em;height:1em;display:inline-block;fill:currentColor;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;font-size:1.5rem;width:6.75rem;}@media (min-width:0px){.css-uz5bjn{;}}@media (min-width:600px){.css-uz5bjn{display:block;}}</style><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-uz5bjn" focusable="false" aria-hidden="true" viewbox="0 0 769.89 203.08"><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path fill="#082265" d="M100.11,47.34l-88-25.1A9.5,9.5,0,0,0,0,31.38v162.2a9.51,9.51,0,0,0,9.48,9.5,9.35,9.35,0,0,0,2.22-.26l88-21h0a9.48,9.48,0,0,0,7.3-9.25V56.48A9.54,9.54,0,0,0,100.11,47.34Z"/><path fill="#00aeef" d="M160.05,41.57a9.55,9.55,0,0,0-6.88-9.11L41.16.37A9.5,9.5,0,0,0,29,9.51V132.59a9.47,9.47,0,0,0,11.72,9.23l112.14-27a9.47,9.47,0,0,0,7.28-9.26Z"/><path fill="#303eab" d="M100.11,47.34,29,27.07V132.59a9.47,9.47,0,0,0,11.72,9.23L107,125.88V56.48A9.54,9.54,0,0,0,100.11,47.34Z"/><path fill="#082265" d="M576.1,126.26h0l-.23.37a40.12,40.12,0,0,1-13.72,13.09,36.62,36.62,0,0,1-18.78,5.43c-10.94,0-20.51-4.36-28.42-13a43.82,43.82,0,0,1-11.37-31,43.09,43.09,0,0,1,11.74-29.38c7.62-8.17,16.81-12.31,27.3-12.31,14.37-.13,25.2,5.8,33.13,18.13L576,78h.22l9.33-5.77a51.65,51.65,0,0,0-15.42-16.39,48.17,48.17,0,0,0-26.73-8.09A46.85,46.85,0,0,0,507.66,63c-9.94,10.23-15,23.28-15,38.77,0,15,5,28.08,14.84,38.9,9.81,10.64,21.69,16,35.33,16h.51c17.92-.37,32.69-9.06,42.11-24.6Z"/><polygon fill="#082265" points="645.84 49.09 633.16 49.09 586.01 154.63 601.05 154.63 615.63 119.55 615.65 119.55 620.8 108.59 620.78 108.59 639.76 64.05 658.36 108.59 631.66 108.59 626.79 119.55 662.69 119.55 677.4 154.63 690.66 154.63 645.84 49.09"/><path fill="#082265" d="M759.63,58.75c-7-6.32-15.81-9.52-26.18-9.52H699.3v105.4h12.44V113.34h0V102.25h0V60.59H734a24.73,24.73,0,0,1,16.22,5.63,18.12,18.12,0,0,1,7.37,14c.39,6.62-1.77,11.88-6.61,16.07a23.43,23.43,0,0,1-16.31,6H721.77v11.09h14.91a33.34,33.34,0,0,0,23.23-8.85,29,29,0,0,0,10-21.91C770,72.89,766.58,64.87,759.63,58.75Z"/><rect fill="#082265" x="296.25" y="51.17" width="12.44" height="12.44"/><rect fill="#082265" x="296.25" y="79.04" width="12.44" height="75.74"/><path fill="#082265" d="M483.63,147.21V114.69a38.6,38.6,0,0,0-12.25-29.2c-8.22-8.22-18.1-12.27-29.35-12a39.17,39.17,0,0,0-27.82,12.54,40.08,40.08,0,0,0-11.29,28.49,41,41,0,0,0,12.24,29.59c8.19,8.18,18,12.12,29.22,11.71a38.78,38.78,0,0,0,27.48-12.33v5.17m0,0c0,6.88-2.73,12.89-8.11,17.88a27.1,27.1,0,0,1-19,7.73,27.83,27.83,0,0,1-16.93-5.64,25.92,25.92,0,0,1-9-10.54l-9.52,5.5a36.63,36.63,0,0,0,9.94,12c6.6,5.25,14.75,8.13,24.23,8.54.59,0,1.18,0,1.77,0a40.89,40.89,0,0,0,26-9.25c8.17-6.52,12.32-14.86,12.32-24.8v-2.95m-12-31.74a29.23,29.23,0,0,1-8.41,20.22,25.68,25.68,0,0,1-19.5,8.38,27.3,27.3,0,0,1-20.2-8.39,28.22,28.22,0,0,1-8.66-20.34,28.66,28.66,0,0,1,7.88-20.61,27.21,27.21,0,0,1,19.53-9.45c.51,0,1,0,1.5,0,7.61,0,14,2.85,19.45,8.69A28.51,28.51,0,0,1,471.59,115.47Z"/><path fill="#082265" d="M274.1,58.75c-7-6.32-15.81-9.52-26.19-9.52H213.76v105.4h12.45V113.34h0V102.25h0V60.59h22.24a24.73,24.73,0,0,1,16.23,5.63,18.12,18.12,0,0,1,7.37,14c.39,6.62-1.77,11.88-6.61,16.07a23.43,23.43,0,0,1-16.31,6H236.24v11.09h14.91a33.34,33.34,0,0,0,23.23-8.85,29,29,0,0,0,10-21.91C284.5,72.89,281.05,64.87,274.1,58.75Z"/><path fill="#082265" d="M357.54,74.41c-9.92,0-18.3,3.43-24.94,10.2s-9.91,15.24-9.91,25.33v44.53h12V108.86a21.82,21.82,0,0,1,6.75-16.1A22.08,22.08,0,0,1,357.54,86a21.49,21.49,0,0,1,15.82,6.75,21.86,21.86,0,0,1,6.89,16.1v45.61h12V109.94c0-10.09-3.34-18.61-9.92-25.33A33.47,33.47,0,0,0,357.54,74.41Z"/></g></g></svg></a></div><style data-emotion="css 5qlh60">.css-5qlh60{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;padding-left:2rem;height:100%;}.css-5qlh60>:not(style)+:not(style){margin:0;margin-left:24px;}@media (min-width:0px){.css-5qlh60{;}}@media (min-width:900px){.css-5qlh60{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}}</style><div class="css-5qlh60"><style data-emotion="css kiou0g">.css-kiou0g{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding-top:0.25rem;padding-bottom:0.25rem;}</style><div class="MuiBox-root css-kiou0g"><a style="text-decoration:none" hreflang="zh" href="/zh/"><style data-emotion="css 2jgwiy">.css-2jgwiy{margin:0;font-size:1rem;line-height:1.5rem;font-family:"Helvetica Neue","sans-serif";font-weight:400;font-style:normal;color:#666666;color:#282a36;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,"IBM Plex Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji";display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:4px;}</style><div class="MuiTypography-root MuiTypography-body1 css-2jgwiy">文档中心</div></a></div><div class="MuiBox-root css-kiou0g"><a style="text-decoration:none" hreflang="zh" href="/zh/tidb/stable"><div class="MuiTypography-root MuiTypography-body1 css-2jgwiy">TiDB</div></a></div><div class="MuiBox-root css-kiou0g"><a class="MuiTypography-root MuiTypography-body1 css-tx8jsd" target="_blank" href="https://asktug.com/" style="text-decoration:none"><div class="MuiTypography-root MuiTypography-body1 css-2jgwiy">社区</div></a></div><div class="MuiBox-root css-kiou0g"><a class="MuiTypography-root MuiTypography-body1 css-tx8jsd" target="_blank" href="https://cn.pingcap.com/contact/" style="text-decoration:none"><div class="MuiTypography-root MuiTypography-body1 css-2jgwiy">联系我们</div></a></div><div class="MuiBox-root css-kiou0g"><a class="MuiTypography-root MuiTypography-body1 css-tx8jsd" target="_blank" href="https://cn.pingcap.com/product/#SelectProduct" style="text-decoration:none"><div class="MuiTypography-root MuiTypography-body1 css-2jgwiy"><style data-emotion="css xnd31y">.css-xnd31y{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:1em;height:1em;display:inline-block;fill:currentColor;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;font-size:inherit;padding-top:0.5rem;}</style><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-xnd31y" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="DownloadIcon"><path d="M5 20h14v-2H5v2zM19 9h-4V3H9v6H5l7 7 7-7z"/></svg></div></a></div></div><style data-emotion="css 1vn3uc0">.css-1vn3uc0{color:#282a36;}@media (min-width:900px){.css-1vn3uc0{;}}</style><div class="MuiBox-root css-1vn3uc0"><style data-emotion="css btg76o">.css-btg76o{text-transform:none;font-family:-apple-system,"Poppins","Helvetica Neue",sans-serif,"Noto Sans","Fira Code","IBM Plex Sans","sans-serif";font-weight:500;font-size:0.875rem;line-height:1.75;min-width:64px;padding:6px 8px;border-radius:4px;-webkit-transition:background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;color:inherit;border-color:currentColor;box-shadow:none;}.css-btg76o:hover{-webkit-text-decoration:none;text-decoration:none;background-color:rgba(0, 0, 0, 0.04);}@media (hover: none){.css-btg76o:hover{background-color:transparent;}}.css-btg76o.Mui-disabled{color:rgba(0, 0, 0, 0.26);}.css-btg76o:hover{box-shadow:none;}.css-btg76o.Mui-focusVisible{box-shadow:none;}.css-btg76o:active{box-shadow:none;}.css-btg76o.Mui-disabled{box-shadow:none;}</style><style data-emotion="css 1ei260h">.css-1ei260h{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;position:relative;box-sizing:border-box;-webkit-tap-highlight-color:transparent;background-color:transparent;outline:0;border:0;margin:0;border-radius:0;padding:0;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;-moz-appearance:none;-webkit-appearance:none;-webkit-text-decoration:none;text-decoration:none;color:inherit;text-transform:none;font-family:-apple-system,"Poppins","Helvetica Neue",sans-serif,"Noto Sans","Fira Code","IBM Plex Sans","sans-serif";font-weight:500;font-size:0.875rem;line-height:1.75;min-width:64px;padding:6px 8px;border-radius:4px;-webkit-transition:background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;color:inherit;border-color:currentColor;box-shadow:none;}.css-1ei260h::-moz-focus-inner{border-style:none;}.css-1ei260h.Mui-disabled{pointer-events:none;cursor:default;}@media print{.css-1ei260h{-webkit-print-color-adjust:exact;color-adjust:exact;}}.css-1ei260h:hover{-webkit-text-decoration:none;text-decoration:none;background-color:rgba(0, 0, 0, 0.04);}@media (hover: none){.css-1ei260h:hover{background-color:transparent;}}.css-1ei260h.Mui-disabled{color:rgba(0, 0, 0, 0.26);}.css-1ei260h:hover{box-shadow:none;}.css-1ei260h.Mui-focusVisible{box-shadow:none;}.css-1ei260h:active{box-shadow:none;}.css-1ei260h.Mui-disabled{box-shadow:none;}</style><button class="MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-textInherit MuiButton-sizeMedium MuiButton-textSizeMedium MuiButton-colorInherit MuiButton-disableElevation css-1ei260h" tabindex="0" type="button" id="header-nav-items" aria-haspopup="true"><style data-emotion="css 6xugel">.css-6xugel{display:inherit;margin-right:8px;margin-left:-4px;}.css-6xugel>*:nth-of-type(1){font-size:20px;}</style><span class="MuiButton-startIcon MuiButton-iconSizeMedium css-6xugel"><style data-emotion="css 1x9zct">.css-1x9zct{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:1em;height:1em;display:inline-block;fill:currentColor;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;font-size:1.5rem;width:6.75rem;height:1.5rem;}</style><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-1x9zct" focusable="false" aria-hidden="true" viewbox="0 0 769.89 203.08"><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path fill="#082265" d="M100.11,47.34l-88-25.1A9.5,9.5,0,0,0,0,31.38v162.2a9.51,9.51,0,0,0,9.48,9.5,9.35,9.35,0,0,0,2.22-.26l88-21h0a9.48,9.48,0,0,0,7.3-9.25V56.48A9.54,9.54,0,0,0,100.11,47.34Z"/><path fill="#00aeef" d="M160.05,41.57a9.55,9.55,0,0,0-6.88-9.11L41.16.37A9.5,9.5,0,0,0,29,9.51V132.59a9.47,9.47,0,0,0,11.72,9.23l112.14-27a9.47,9.47,0,0,0,7.28-9.26Z"/><path fill="#303eab" d="M100.11,47.34,29,27.07V132.59a9.47,9.47,0,0,0,11.72,9.23L107,125.88V56.48A9.54,9.54,0,0,0,100.11,47.34Z"/><path fill="#082265" d="M576.1,126.26h0l-.23.37a40.12,40.12,0,0,1-13.72,13.09,36.62,36.62,0,0,1-18.78,5.43c-10.94,0-20.51-4.36-28.42-13a43.82,43.82,0,0,1-11.37-31,43.09,43.09,0,0,1,11.74-29.38c7.62-8.17,16.81-12.31,27.3-12.31,14.37-.13,25.2,5.8,33.13,18.13L576,78h.22l9.33-5.77a51.65,51.65,0,0,0-15.42-16.39,48.17,48.17,0,0,0-26.73-8.09A46.85,46.85,0,0,0,507.66,63c-9.94,10.23-15,23.28-15,38.77,0,15,5,28.08,14.84,38.9,9.81,10.64,21.69,16,35.33,16h.51c17.92-.37,32.69-9.06,42.11-24.6Z"/><polygon fill="#082265" points="645.84 49.09 633.16 49.09 586.01 154.63 601.05 154.63 615.63 119.55 615.65 119.55 620.8 108.59 620.78 108.59 639.76 64.05 658.36 108.59 631.66 108.59 626.79 119.55 662.69 119.55 677.4 154.63 690.66 154.63 645.84 49.09"/><path fill="#082265" d="M759.63,58.75c-7-6.32-15.81-9.52-26.18-9.52H699.3v105.4h12.44V113.34h0V102.25h0V60.59H734a24.73,24.73,0,0,1,16.22,5.63,18.12,18.12,0,0,1,7.37,14c.39,6.62-1.77,11.88-6.61,16.07a23.43,23.43,0,0,1-16.31,6H721.77v11.09h14.91a33.34,33.34,0,0,0,23.23-8.85,29,29,0,0,0,10-21.91C770,72.89,766.58,64.87,759.63,58.75Z"/><rect fill="#082265" x="296.25" y="51.17" width="12.44" height="12.44"/><rect fill="#082265" x="296.25" y="79.04" width="12.44" height="75.74"/><path fill="#082265" d="M483.63,147.21V114.69a38.6,38.6,0,0,0-12.25-29.2c-8.22-8.22-18.1-12.27-29.35-12a39.17,39.17,0,0,0-27.82,12.54,40.08,40.08,0,0,0-11.29,28.49,41,41,0,0,0,12.24,29.59c8.19,8.18,18,12.12,29.22,11.71a38.78,38.78,0,0,0,27.48-12.33v5.17m0,0c0,6.88-2.73,12.89-8.11,17.88a27.1,27.1,0,0,1-19,7.73,27.83,27.83,0,0,1-16.93-5.64,25.92,25.92,0,0,1-9-10.54l-9.52,5.5a36.63,36.63,0,0,0,9.94,12c6.6,5.25,14.75,8.13,24.23,8.54.59,0,1.18,0,1.77,0a40.89,40.89,0,0,0,26-9.25c8.17-6.52,12.32-14.86,12.32-24.8v-2.95m-12-31.74a29.23,29.23,0,0,1-8.41,20.22,25.68,25.68,0,0,1-19.5,8.38,27.3,27.3,0,0,1-20.2-8.39,28.22,28.22,0,0,1-8.66-20.34,28.66,28.66,0,0,1,7.88-20.61,27.21,27.21,0,0,1,19.53-9.45c.51,0,1,0,1.5,0,7.61,0,14,2.85,19.45,8.69A28.51,28.51,0,0,1,471.59,115.47Z"/><path fill="#082265" d="M274.1,58.75c-7-6.32-15.81-9.52-26.19-9.52H213.76v105.4h12.45V113.34h0V102.25h0V60.59h22.24a24.73,24.73,0,0,1,16.23,5.63,18.12,18.12,0,0,1,7.37,14c.39,6.62-1.77,11.88-6.61,16.07a23.43,23.43,0,0,1-16.31,6H236.24v11.09h14.91a33.34,33.34,0,0,0,23.23-8.85,29,29,0,0,0,10-21.91C284.5,72.89,281.05,64.87,274.1,58.75Z"/><path fill="#082265" d="M357.54,74.41c-9.92,0-18.3,3.43-24.94,10.2s-9.91,15.24-9.91,25.33v44.53h12V108.86a21.82,21.82,0,0,1,6.75-16.1A22.08,22.08,0,0,1,357.54,86a21.49,21.49,0,0,1,15.82,6.75,21.86,21.86,0,0,1,6.89,16.1v45.61h12V109.94c0-10.09-3.34-18.61-9.92-25.33A33.47,33.47,0,0,0,357.54,74.41Z"/></g></g></svg></span><style data-emotion="css 1n4a93h">.css-1n4a93h{display:inherit;margin-right:-4px;margin-left:8px;}.css-1n4a93h>*:nth-of-type(1){font-size:20px;}</style><span class="MuiButton-endIcon MuiButton-iconSizeMedium css-1n4a93h"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="KeyboardArrowDownIcon"><path d="M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"/></svg></span></button></div><style data-emotion="css jnv64h">.css-jnv64h{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;margin-left:auto;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}@media (min-width:0px){.css-jnv64h>:not(style)+:not(style){margin:0;margin-left:8px;}}@media (min-width:1200px){.css-jnv64h>:not(style)+:not(style){margin:0;margin-left:24px;}}</style><div class="css-jnv64h"><style data-emotion="css 1qlh2t1">.css-1qlh2t1{color:#282a36;}</style><div class="MuiBox-root css-1qlh2t1"><style data-emotion="css 1mvsusm">.css-1mvsusm{text-align:center;-webkit-flex:0 0 auto;-ms-flex:0 0 auto;flex:0 0 auto;font-size:1.5rem;padding:8px;border-radius:50%;overflow:visible;color:rgba(0, 0, 0, 0.54);-webkit-transition:background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;color:inherit;}.css-1mvsusm:hover{background-color:rgba(0, 0, 0, 0.04);}@media (hover: none){.css-1mvsusm:hover{background-color:transparent;}}.css-1mvsusm.Mui-disabled{background-color:transparent;color:rgba(0, 0, 0, 0.26);}@media (min-width:1200px){.css-1mvsusm{;}}</style><style data-emotion="css jwr93t">.css-jwr93t{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;position:relative;box-sizing:border-box;-webkit-tap-highlight-color:transparent;background-color:transparent;outline:0;border:0;margin:0;border-radius:0;padding:0;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;-moz-appearance:none;-webkit-appearance:none;-webkit-text-decoration:none;text-decoration:none;color:inherit;text-align:center;-webkit-flex:0 0 auto;-ms-flex:0 0 auto;flex:0 0 auto;font-size:1.5rem;padding:8px;border-radius:50%;overflow:visible;color:rgba(0, 0, 0, 0.54);-webkit-transition:background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;color:inherit;}.css-jwr93t::-moz-focus-inner{border-style:none;}.css-jwr93t.Mui-disabled{pointer-events:none;cursor:default;}@media print{.css-jwr93t{-webkit-print-color-adjust:exact;color-adjust:exact;}}.css-jwr93t:hover{background-color:rgba(0, 0, 0, 0.04);}@media (hover: none){.css-jwr93t:hover{background-color:transparent;}}.css-jwr93t.Mui-disabled{background-color:transparent;color:rgba(0, 0, 0, 0.26);}@media (min-width:1200px){.css-jwr93t{;}}</style><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeMedium css-jwr93t" tabindex="0" type="button"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="LanguageIcon"><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56zM12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96zM4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2 0 .68.06 1.34.14 2H4.26zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56zm2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8zM12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96zM14.34 14H9.66c-.09-.66-.16-1.32-.16-2 0-.68.07-1.35.16-2h4.68c.09.65.16 1.32.16 2 0 .68-.07 1.34-.16 2zm.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56zM16.36 14c.08-.66.14-1.32.14-2 0-.68-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2h-3.38z"/></svg></button><style data-emotion="css t5gsfy">.css-t5gsfy{text-transform:none;font-family:-apple-system,"Poppins","Helvetica Neue",sans-serif,"Noto Sans","Fira Code","IBM Plex Sans","sans-serif";font-weight:500;font-size:0.875rem;line-height:1.75;min-width:64px;padding:6px 8px;border-radius:4px;-webkit-transition:background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;color:inherit;border-color:currentColor;box-shadow:none;}.css-t5gsfy:hover{-webkit-text-decoration:none;text-decoration:none;background-color:rgba(0, 0, 0, 0.04);}@media (hover: none){.css-t5gsfy:hover{background-color:transparent;}}.css-t5gsfy.Mui-disabled{color:rgba(0, 0, 0, 0.26);}.css-t5gsfy:hover{box-shadow:none;}.css-t5gsfy.Mui-focusVisible{box-shadow:none;}.css-t5gsfy:active{box-shadow:none;}.css-t5gsfy.Mui-disabled{box-shadow:none;}@media (min-width:0px){.css-t5gsfy{;}}@media (min-width:1200px){.css-t5gsfy{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}}</style><style data-emotion="css 1csz7wa">.css-1csz7wa{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;position:relative;box-sizing:border-box;-webkit-tap-highlight-color:transparent;background-color:transparent;outline:0;border:0;margin:0;border-radius:0;padding:0;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;-moz-appearance:none;-webkit-appearance:none;-webkit-text-decoration:none;text-decoration:none;color:inherit;text-transform:none;font-family:-apple-system,"Poppins","Helvetica Neue",sans-serif,"Noto Sans","Fira Code","IBM Plex Sans","sans-serif";font-weight:500;font-size:0.875rem;line-height:1.75;min-width:64px;padding:6px 8px;border-radius:4px;-webkit-transition:background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;color:inherit;border-color:currentColor;box-shadow:none;}.css-1csz7wa::-moz-focus-inner{border-style:none;}.css-1csz7wa.Mui-disabled{pointer-events:none;cursor:default;}@media print{.css-1csz7wa{-webkit-print-color-adjust:exact;color-adjust:exact;}}.css-1csz7wa:hover{-webkit-text-decoration:none;text-decoration:none;background-color:rgba(0, 0, 0, 0.04);}@media (hover: none){.css-1csz7wa:hover{background-color:transparent;}}.css-1csz7wa.Mui-disabled{color:rgba(0, 0, 0, 0.26);}.css-1csz7wa:hover{box-shadow:none;}.css-1csz7wa.Mui-focusVisible{box-shadow:none;}.css-1csz7wa:active{box-shadow:none;}.css-1csz7wa.Mui-disabled{box-shadow:none;}@media (min-width:0px){.css-1csz7wa{;}}@media (min-width:1200px){.css-1csz7wa{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}}</style><button class="MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-textInherit MuiButton-sizeMedium MuiButton-textSizeMedium MuiButton-colorInherit MuiButton-disableElevation css-1csz7wa" tabindex="0" type="button" id="header-lang-switch" aria-haspopup="true"><span class="MuiButton-startIcon MuiButton-iconSizeMedium css-6xugel"><style data-emotion="css 1slalk2">.css-1slalk2{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:1em;height:1em;display:inline-block;fill:currentColor;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;font-size:1.5rem;fill:#282a36;}</style><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-1slalk2" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="LanguageIcon"><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56zM12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96zM4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2 0 .68.06 1.34.14 2H4.26zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56zm2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8zM12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96zM14.34 14H9.66c-.09-.66-.16-1.32-.16-2 0-.68.07-1.35.16-2h4.68c.09.65.16 1.32.16 2 0 .68-.07 1.34-.16 2zm.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56zM16.36 14c.08-.66.14-1.32.14-2 0-.68-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2h-3.38z"/></svg></span><style data-emotion="css 15r93eu">.css-15r93eu{margin:0;font-size:1rem;line-height:1.5rem;font-family:"Helvetica Neue","sans-serif";font-weight:400;font-style:normal;color:#666666;color:inherit;}</style><span class="MuiTypography-root MuiTypography-body1 css-15r93eu">语言</span><span class="MuiButton-endIcon MuiButton-iconSizeMedium css-1n4a93h"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-1slalk2" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="KeyboardArrowDownIcon"><path d="M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"/></svg></span></button></div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeMedium css-iuftj9" tabindex="0" type="button"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="SearchIcon"><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg></button><style data-emotion="css ahtg4s">.css-ahtg4s{max-width:13rem;}@media (min-width:0px){.css-ahtg4s{;}}@media (min-width:1200px){.css-ahtg4s{display:block;}}</style><form class="MuiBox-root css-ahtg4s" novalidate="" autocomplete="off"><style data-emotion="css 24u6h2">.css-24u6h2 .MuiOutlinedInput-root:hover fieldset{border-color:#0ca6f2;border-width:1px;}.css-24u6h2 .MuiOutlinedInput-root.Mui-focused fieldset{border-color:#0ca6f2;border-width:1px;}</style><style data-emotion="css fzbqas">.css-fzbqas .MuiOutlinedInput-root:hover fieldset{border-color:#0ca6f2;border-width:1px;}.css-fzbqas .MuiOutlinedInput-root.Mui-focused fieldset{border-color:#0ca6f2;border-width:1px;}</style><style data-emotion="css bj7gct">.css-bj7gct{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;position:relative;min-width:0;padding:0;margin:0;border:0;vertical-align:top;width:100%;}.css-bj7gct .MuiOutlinedInput-root:hover fieldset{border-color:#0ca6f2;border-width:1px;}.css-bj7gct .MuiOutlinedInput-root.Mui-focused fieldset{border-color:#0ca6f2;border-width:1px;}</style><div class="MuiFormControl-root MuiFormControl-fullWidth MuiTextField-root css-bj7gct"><style data-emotion="css-global 1prfaxn">@-webkit-keyframes mui-auto-fill{from{display:block;}}@keyframes mui-auto-fill{from{display:block;}}@-webkit-keyframes mui-auto-fill-cancel{from{display:block;}}@keyframes mui-auto-fill-cancel{from{display:block;}}</style><style data-emotion="css sv5gtw">.css-sv5gtw{font-size:1rem;line-height:1.4375em;font-family:"Helvetica Neue","sans-serif";font-weight:400;font-style:normal;color:rgba(0, 0, 0, 0.87);box-sizing:border-box;position:relative;cursor:text;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:100%;position:relative;border-radius:4px;padding-left:14px;background:#fff;}.css-sv5gtw.Mui-disabled{color:rgba(0, 0, 0, 0.38);cursor:default;}.css-sv5gtw:hover .MuiOutlinedInput-notchedOutline{border-color:rgba(0, 0, 0, 0.87);}@media (hover: none){.css-sv5gtw:hover .MuiOutlinedInput-notchedOutline{border-color:rgba(0, 0, 0, 0.23);}}.css-sv5gtw.Mui-focused .MuiOutlinedInput-notchedOutline{border-color:#1976d2;border-width:2px;}.css-sv5gtw.Mui-error .MuiOutlinedInput-notchedOutline{border-color:#d32f2f;}.css-sv5gtw.Mui-disabled .MuiOutlinedInput-notchedOutline{border-color:rgba(0, 0, 0, 0.26);}</style><div class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall MuiInputBase-adornedStart css-sv5gtw"><style data-emotion="css 1a6giau">.css-1a6giau{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;height:0.01em;max-height:2em;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;white-space:nowrap;color:rgba(0, 0, 0, 0.54);margin-right:8px;}</style><div class="MuiInputAdornment-root MuiInputAdornment-positionStart MuiInputAdornment-outlined MuiInputAdornment-sizeSmall css-1a6giau"><span class="notranslate"></span><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-vubbuv" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="SearchIcon"><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg></div><style data-emotion="css f2zrvi">.css-f2zrvi{font:inherit;letter-spacing:inherit;color:currentColor;padding:4px 0 5px;border:0;box-sizing:content-box;background:none;height:1.4375em;margin:0;-webkit-tap-highlight-color:transparent;display:block;min-width:0;width:100%;-webkit-animation-name:mui-auto-fill-cancel;animation-name:mui-auto-fill-cancel;-webkit-animation-duration:10ms;animation-duration:10ms;padding-top:1px;-moz-appearance:textfield;padding:8.5px 14px;padding-left:0;}.css-f2zrvi::-webkit-input-placeholder{color:currentColor;opacity:0.42;-webkit-transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;}.css-f2zrvi::-moz-placeholder{color:currentColor;opacity:0.42;-webkit-transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;}.css-f2zrvi:-ms-input-placeholder{color:currentColor;opacity:0.42;-webkit-transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;}.css-f2zrvi::-ms-input-placeholder{color:currentColor;opacity:0.42;-webkit-transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:opacity 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;}.css-f2zrvi:focus{outline:0;}.css-f2zrvi:invalid{box-shadow:none;}.css-f2zrvi::-webkit-search-decoration{-webkit-appearance:none;}label[data-shrink=false]+.MuiInputBase-formControl .css-f2zrvi::-webkit-input-placeholder{opacity:0!important;}label[data-shrink=false]+.MuiInputBase-formControl .css-f2zrvi::-moz-placeholder{opacity:0!important;}label[data-shrink=false]+.MuiInputBase-formControl .css-f2zrvi:-ms-input-placeholder{opacity:0!important;}label[data-shrink=false]+.MuiInputBase-formControl .css-f2zrvi::-ms-input-placeholder{opacity:0!important;}label[data-shrink=false]+.MuiInputBase-formControl .css-f2zrvi:focus::-webkit-input-placeholder{opacity:0.42;}label[data-shrink=false]+.MuiInputBase-formControl .css-f2zrvi:focus::-moz-placeholder{opacity:0.42;}label[data-shrink=false]+.MuiInputBase-formControl .css-f2zrvi:focus:-ms-input-placeholder{opacity:0.42;}label[data-shrink=false]+.MuiInputBase-formControl .css-f2zrvi:focus::-ms-input-placeholder{opacity:0.42;}.css-f2zrvi.Mui-disabled{opacity:1;-webkit-text-fill-color:rgba(0, 0, 0, 0.38);}.css-f2zrvi:-webkit-autofill{-webkit-animation-duration:5000s;animation-duration:5000s;-webkit-animation-name:mui-auto-fill;animation-name:mui-auto-fill;}.css-f2zrvi:-webkit-autofill{border-radius:inherit;}</style><input type="search" aria-invalid="false" id="doc-search" placeholder="搜索文档" value="" class="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputTypeSearch MuiInputBase-inputSizeSmall MuiInputBase-inputAdornedStart css-f2zrvi"/><style data-emotion="css 19w1uun">.css-19w1uun{border-color:rgba(0, 0, 0, 0.23);}</style><style data-emotion="css igs3ac">.css-igs3ac{text-align:left;bottom:0;right:0;top:-5px;left:0;margin:0;padding:0 8px;pointer-events:none;border-radius:inherit;border-style:solid;border-width:1px;overflow:hidden;min-width:0%;border-color:rgba(0, 0, 0, 0.23);}</style><fieldset aria-hidden="true" class="MuiOutlinedInput-notchedOutline css-igs3ac"><style data-emotion="css hdw1oc">.css-hdw1oc{float:unset;overflow:hidden;padding:0;line-height:11px;-webkit-transition:width 150ms cubic-bezier(0.0, 0, 0.2, 1) 0ms;transition:width 150ms cubic-bezier(0.0, 0, 0.2, 1) 0ms;}</style><legend class="css-hdw1oc"><span class="notranslate"></span></legend></fieldset></div></div></form></div></div></header><style data-emotion="css s1brf2">.css-s1brf2{margin-top:5rem;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}</style><div class="PingCAP-Doc MuiBox-root css-s1brf2"><style data-emotion="css hboir5">.css-hboir5{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;width:100%;}</style><div class="MuiBox-root css-hboir5"><style data-emotion="css 2tzg8">.css-2tzg8{width:18.75rem;border-right:1px solid #E5E4E4;}@media (min-width:0px){.css-2tzg8{;}}@media (min-width:1200px){.css-2tzg8{display:block;}}</style><aside class="MuiBox-root css-2tzg8"><style data-emotion="css 1eohm8p">.css-1eohm8p{position:-webkit-sticky;position:sticky;top:5rem;height:100%;max-height:calc(100vh - 7rem);overflow-y:auto;padding:1rem;}</style><div class="MuiBox-root css-1eohm8p"><style data-emotion="css fmyu0n">.css-fmyu0n{text-transform:none;font-family:-apple-system,"Poppins","Helvetica Neue",sans-serif,"Noto Sans","Fira Code","IBM Plex Sans","sans-serif";font-weight:500;font-size:0.875rem;line-height:1.75;min-width:64px;padding:6px 8px;border-radius:4px;-webkit-transition:background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;color:#1976d2;width:100%;height:2rem;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;border-style:solid;border-width:1px;border-color:#e5e5e5;margin-bottom:1rem;}.css-fmyu0n:hover{-webkit-text-decoration:none;text-decoration:none;background-color:rgba(25, 118, 210, 0.04);}@media (hover: none){.css-fmyu0n:hover{background-color:transparent;}}.css-fmyu0n.Mui-disabled{color:rgba(0, 0, 0, 0.26);}</style><style data-emotion="css 1rq233s">.css-1rq233s{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;position:relative;box-sizing:border-box;-webkit-tap-highlight-color:transparent;background-color:transparent;outline:0;border:0;margin:0;border-radius:0;padding:0;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;-moz-appearance:none;-webkit-appearance:none;-webkit-text-decoration:none;text-decoration:none;color:inherit;text-transform:none;font-family:-apple-system,"Poppins","Helvetica Neue",sans-serif,"Noto Sans","Fira Code","IBM Plex Sans","sans-serif";font-weight:500;font-size:0.875rem;line-height:1.75;min-width:64px;padding:6px 8px;border-radius:4px;-webkit-transition:background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;color:#1976d2;width:100%;height:2rem;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;border-style:solid;border-width:1px;border-color:#e5e5e5;margin-bottom:1rem;}.css-1rq233s::-moz-focus-inner{border-style:none;}.css-1rq233s.Mui-disabled{pointer-events:none;cursor:default;}@media print{.css-1rq233s{-webkit-print-color-adjust:exact;color-adjust:exact;}}.css-1rq233s:hover{-webkit-text-decoration:none;text-decoration:none;background-color:rgba(25, 118, 210, 0.04);}@media (hover: none){.css-1rq233s:hover{background-color:transparent;}}.css-1rq233s.Mui-disabled{color:rgba(0, 0, 0, 0.26);}</style><button class="MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-textPrimary MuiButton-sizeMedium MuiButton-textSizeMedium css-1rq233s" tabindex="0" type="button" id="version-select-button" aria-haspopup="true"><style data-emotion="css 3cb5vr">.css-3cb5vr{margin:0;font-size:1rem;line-height:1.5rem;font-family:"Helvetica Neue","sans-serif";font-weight:400;font-style:normal;color:#666666;padding:0 0.25rem;font-size:0.875rem;line-height:1.25rem;}</style><div class="MuiTypography-root MuiTypography-body1 css-3cb5vr">v7.1</div><style data-emotion="css 1n4a93h">.css-1n4a93h{display:inherit;margin-right:-4px;margin-left:8px;}.css-1n4a93h>*:nth-of-type(1){font-size:20px;}</style><span class="MuiButton-endIcon MuiButton-iconSizeMedium css-1n4a93h"><style data-emotion="css b5l66">.css-b5l66{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:1em;height:1em;display:inline-block;fill:currentColor;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;font-size:1.5rem;-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);height:1.5rem;width:1.5rem;fill:#999999;margin-right:0.25rem;}</style><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-b5l66" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></span></button><style data-emotion="css 1c58svf">.css-1c58svf .MuiPaper-root{border-radius:6px;margin-top:8px;min-width:268px;color:rgb(55, 65, 81);box-shadow:rgb(255, 255, 255) 0px 0px 0px 0px,rgba(0, 0, 0, 0.05) 0px 0px 0px 1px,rgba(0, 0, 0, 0.1) 0px 10px 15px -3px,rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;}.css-1c58svf .MuiPaper-root .MuiMenu-list{padding:4px 0;}.css-1c58svf .MuiPaper-root .MuiMenuItem-root .MuiSvgIcon-root{font-size:18px;color:rgba(0, 0, 0, 0.6);margin-right:12px;}.css-1c58svf .MuiPaper-root .MuiMenuItem-root:active{background-color:rgba(25, 118, 210, 0.08);}</style><style data-emotion="css yvxbj">.css-yvxbj .MuiPaper-root{border-radius:6px;margin-top:8px;min-width:268px;color:rgb(55, 65, 81);box-shadow:rgb(255, 255, 255) 0px 0px 0px 0px,rgba(0, 0, 0, 0.05) 0px 0px 0px 1px,rgba(0, 0, 0, 0.1) 0px 10px 15px -3px,rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;}.css-yvxbj .MuiPaper-root .MuiMenu-list{padding:4px 0;}.css-yvxbj .MuiPaper-root .MuiMenuItem-root .MuiSvgIcon-root{font-size:18px;color:rgba(0, 0, 0, 0.6);margin-right:12px;}.css-yvxbj .MuiPaper-root .MuiMenuItem-root:active{background-color:rgba(25, 118, 210, 0.08);}</style><style data-emotion="css oe3wem">.css-oe3wem .MuiPaper-root{border-radius:6px;margin-top:8px;min-width:268px;color:rgb(55, 65, 81);box-shadow:rgb(255, 255, 255) 0px 0px 0px 0px,rgba(0, 0, 0, 0.05) 0px 0px 0px 1px,rgba(0, 0, 0, 0.1) 0px 10px 15px -3px,rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;}.css-oe3wem .MuiPaper-root .MuiMenu-list{padding:4px 0;}.css-oe3wem .MuiPaper-root .MuiMenuItem-root .MuiSvgIcon-root{font-size:18px;color:rgba(0, 0, 0, 0.6);margin-right:12px;}.css-oe3wem .MuiPaper-root .MuiMenuItem-root:active{background-color:rgba(25, 118, 210, 0.08);}</style><style data-emotion="css 12mehxg">.css-12mehxg{padding:0;margin:0;list-style:none;outline:0;}</style><ul role="tree" id="left-nav-treeview" aria-multiselectable="false" class="MuiTreeView-root css-12mehxg" tabindex="0" aria-label="left navigation"><style data-emotion="css 1gesgke">.css-1gesgke .MuiTreeItem-content{color:#282a36;border-radius:4px;}.css-1gesgke .MuiTreeItem-content:hover{background-color:#f9f9f9;}.css-1gesgke .MuiTreeItem-content.Mui-selected,.css-1gesgke .MuiTreeItem-content.Mui-selected.Mui-focused{background-color:var(--tree-view-bg-color, #EAF6FB);color:var(--tree-view-color, #0A85C2);}.css-1gesgke .MuiTreeItem-content.Mui-selected svg.MuiTreeItem-ChevronRightIcon,.css-1gesgke .MuiTreeItem-content.Mui-selected.Mui-focused svg.MuiTreeItem-ChevronRightIcon{fill:var(--tree-view-color, #0A85C2);}.css-1gesgke .MuiTreeItem-content.Mui-focused{background-color:#f9f9f9;}.css-1gesgke .MuiTreeItem-content .MuiTreeItem-label{font-weight:inherit;color:inherit;}.css-1gesgke .MuiTreeItem-content .MuiTreeItem-iconContainer{;}.css-1gesgke .MuiTreeItem-group{margin-left:0;}.css-1gesgke .MuiTreeItem-group .MuiTreeItem-content{padding-left:16px;}</style><style data-emotion="css 1oy5rnm">.css-1oy5rnm{list-style:none;margin:0;padding:0;outline:0;}.css-1oy5rnm .MuiTreeItem-content{color:#282a36;border-radius:4px;}.css-1oy5rnm .MuiTreeItem-content:hover{background-color:#f9f9f9;}.css-1oy5rnm .MuiTreeItem-content.Mui-selected,.css-1oy5rnm .MuiTreeItem-content.Mui-selected.Mui-focused{background-color:var(--tree-view-bg-color, #EAF6FB);color:var(--tree-view-color, #0A85C2);}.css-1oy5rnm .MuiTreeItem-content.Mui-selected svg.MuiTreeItem-ChevronRightIcon,.css-1oy5rnm .MuiTreeItem-content.Mui-selected.Mui-focused svg.MuiTreeItem-ChevronRightIcon{fill:var(--tree-view-color, #0A85C2);}.css-1oy5rnm .MuiTreeItem-content.Mui-focused{background-color:#f9f9f9;}.css-1oy5rnm .MuiTreeItem-content .MuiTreeItem-label{font-weight:inherit;color:inherit;}.css-1oy5rnm .MuiTreeItem-content .MuiTreeItem-iconContainer{;}.css-1oy5rnm .MuiTreeItem-group{margin-left:0;}.css-1oy5rnm .MuiTreeItem-group .MuiTreeItem-content{padding-left:16px;}</style><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" id="left-nav-treeview-0-0" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><style data-emotion="css khel7y">.css-khel7y{padding:0 8px;width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:pointer;-webkit-tap-highlight-color:transparent;}.css-khel7y:hover{background-color:rgba(0, 0, 0, 0.04);}@media (hover: none){.css-khel7y:hover{background-color:transparent;}}.css-khel7y.Mui-disabled{opacity:0.38;background-color:transparent;}.css-khel7y.Mui-focused{background-color:rgba(0, 0, 0, 0.12);}.css-khel7y.Mui-selected{background-color:rgba(25, 118, 210, 0.08);}.css-khel7y.Mui-selected:hover{background-color:rgba(25, 118, 210, 0.12);}@media (hover: none){.css-khel7y.Mui-selected:hover{background-color:rgba(25, 118, 210, 0.08);}}.css-khel7y.Mui-selected.Mui-focused{background-color:rgba(25, 118, 210, 0.2);}.css-khel7y .MuiTreeItem-iconContainer{margin-right:4px;width:15px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;}.css-khel7y .MuiTreeItem-iconContainer svg{font-size:18px;}.css-khel7y .MuiTreeItem-label{width:100%;min-width:0;padding-left:4px;position:relative;font-size:1rem;line-height:1.5rem;font-family:"Helvetica Neue","sans-serif";font-weight:400;font-style:normal;color:#666666;}</style><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><style data-emotion="css znl8a3">.css-znl8a3{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;min-height:1.75rem;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding-left:0rem;padding-top:0.25rem;padding-bottom:0.25rem;}</style><div class="css-znl8a3"><style data-emotion="css tx8jsd">.css-tx8jsd{margin:0;font-size:1rem;line-height:1.5rem;font-family:"Helvetica Neue","sans-serif";font-weight:400;font-style:normal;color:#666666;}</style><a class="MuiTypography-root MuiTypography-body1 css-tx8jsd" target="_blank" href="https://docs.pingcap.com/zh" style="text-decoration:none;width:100%;color:inherit"><style data-emotion="css 8atqhb">.css-8atqhb{width:100%;}</style><div class="MuiBox-root css-8atqhb"><style data-emotion="css 1hwyipb">.css-1hwyipb{margin:0;font-size:1rem;line-height:1.5rem;font-family:"Helvetica Neue","sans-serif";font-weight:400;font-style:normal;color:#666666;color:inherit;font-size:0.875rem;line-height:1.25rem;}</style><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">文档中心</div></div></a></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-1" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-znl8a3"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">关于 TiDB</div></div><style data-emotion="css xjq79n">.css-xjq79n{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:1em;height:1em;display:inline-block;fill:currentColor;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;font-size:1.5rem;fill:#999999;height:1rem;width:1rem;margin-left:auto;-webkit-transform:none;-moz-transform:none;-ms-transform:none;transform:none;}</style><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div><style data-emotion="css 1jozaee">.css-1jozaee{margin:0;padding:0;margin-left:17px;}</style></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-2" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-znl8a3"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">快速上手</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-3" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-znl8a3"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">应用开发</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-4" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-znl8a3"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">部署标准集群</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-5" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-znl8a3"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">数据迁移</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-6" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-znl8a3"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">数据集成</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-7" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-znl8a3"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">运维操作</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-8" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-znl8a3"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">监控与告警</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-9" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-znl8a3"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">故障诊断</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-10" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-znl8a3"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">性能调优</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-11" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-znl8a3"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">教程</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-12" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-znl8a3"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">TiDB 工具</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="true" id="left-nav-treeview-0-13" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content Mui-expanded" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-znl8a3"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">参考指南</div></div><style data-emotion="css 171pefp">.css-171pefp{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:1em;height:1em;display:inline-block;fill:currentColor;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;font-size:1.5rem;fill:#999999;height:1rem;width:1rem;margin-left:auto;-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);}</style><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-171pefp" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div><style data-emotion="css 1xxsnna">.css-1xxsnna{height:auto;overflow:visible;-webkit-transition:height 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:height 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;margin:0;padding:0;margin-left:17px;}</style><ul class="MuiCollapse-root MuiCollapse-vertical MuiTreeItem-group MuiCollapse-entered css-1xxsnna" style="min-height:0px" role="group"><div class="MuiCollapse-wrapper MuiCollapse-vertical css-hboir5"><div class="MuiCollapse-wrapperInner MuiCollapse-vertical css-8atqhb"><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-13-0" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><style data-emotion="css kb2j4b">.css-kb2j4b{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;min-height:1.75rem;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding-left:0.5rem;padding-top:0.25rem;padding-bottom:0.25rem;}</style><div class="css-kb2j4b"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">架构</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-13-1" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-kb2j4b"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">存储引擎 TiKV</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-13-2" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-kb2j4b"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">存储引擎 TiFlash</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" id="left-nav-treeview-0-13-3" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-kb2j4b"><a style="text-decoration:none;width:100%;color:inherit" href="/zh/tidb/stable/system-variables"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">系统变量</div></div></a></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-13-4" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-kb2j4b"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">配置文件参数</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-13-5" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-kb2j4b"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">CLI</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-13-6" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-kb2j4b"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">命令行参数</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-13-7" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-kb2j4b"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">监控指标</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-13-8" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-kb2j4b"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">安全加固</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-13-9" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-kb2j4b"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">权限</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="true" id="left-nav-treeview-0-13-10" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content Mui-expanded" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-kb2j4b"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">SQL</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-171pefp" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div><ul class="MuiCollapse-root MuiCollapse-vertical MuiTreeItem-group MuiCollapse-entered css-1xxsnna" style="min-height:0px" role="group"><div class="MuiCollapse-wrapper MuiCollapse-vertical css-hboir5"><div class="MuiCollapse-wrapperInner MuiCollapse-vertical css-8atqhb"><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-13-10-0" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><style data-emotion="css snygwd">.css-snygwd{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;min-height:1.75rem;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding-left:1rem;padding-top:0.25rem;padding-bottom:0.25rem;}</style><div class="css-snygwd"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">SQL 语言结构和语法</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-13-10-1" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-snygwd"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">SQL 语句</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-13-10-2" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-snygwd"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">数据类型</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-13-10-3" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-snygwd"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">函数与操作符</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" id="left-nav-treeview-0-13-10-4" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-snygwd"><a style="text-decoration:none;width:100%;color:inherit" href="/zh/tidb/stable/clustered-indexes"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">聚簇索引</div></div></a></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" id="left-nav-treeview-0-13-10-5" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-snygwd"><a style="text-decoration:none;width:100%;color:inherit" href="/zh/tidb/stable/constraints"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">约束</div></div></a></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" id="left-nav-treeview-0-13-10-6" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-snygwd"><a style="text-decoration:none;width:100%;color:inherit" href="/zh/tidb/stable/generated-columns"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">生成列</div></div></a></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" id="left-nav-treeview-0-13-10-7" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-snygwd"><a style="text-decoration:none;width:100%;color:inherit" href="/zh/tidb/stable/sql-mode"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">SQL 模式</div></div></a></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" id="left-nav-treeview-0-13-10-8" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-snygwd"><a style="text-decoration:none;width:100%;color:inherit" href="/zh/tidb/stable/table-attributes"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">表属性</div></div></a></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-13-10-9" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-snygwd"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">事务</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" id="left-nav-treeview-0-13-10-10" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-snygwd"><a style="text-decoration:none;width:100%;color:inherit" href="/zh/tidb/stable/views"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">视图</div></div></a></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" id="left-nav-treeview-0-13-10-11" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-snygwd"><a style="text-decoration:none;width:100%;color:inherit" href="/zh/tidb/stable/partitioned-table"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">分区表</div></div></a></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" id="left-nav-treeview-0-13-10-12" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-snygwd"><a style="text-decoration:none;width:100%;color:inherit" href="/zh/tidb/stable/temporary-tables"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">临时表</div></div></a></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" id="left-nav-treeview-0-13-10-13" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-snygwd"><a style="text-decoration:none;width:100%;color:inherit" href="/zh/tidb/stable/cached-tables"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">缓存表</div></div></a></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" id="left-nav-treeview-0-13-10-14" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-snygwd"><a style="text-decoration:none;width:100%;color:inherit" href="/zh/tidb/stable/foreign-key"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">外键约束</div></div></a></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="true" id="left-nav-treeview-0-13-10-15" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content Mui-expanded" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-snygwd"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">字符集和排序</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-171pefp" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div><ul class="MuiCollapse-root MuiCollapse-vertical MuiTreeItem-group MuiCollapse-entered css-1xxsnna" style="min-height:0px" role="group"><div class="MuiCollapse-wrapper MuiCollapse-vertical css-hboir5"><div class="MuiCollapse-wrapperInner MuiCollapse-vertical css-8atqhb"><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" id="left-nav-treeview-0-13-10-15-0" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content Mui-expanded" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><style data-emotion="css 5fc025">.css-5fc025{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;min-height:1.75rem;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding-left:1.5rem;padding-top:0.25rem;padding-bottom:0.25rem;}</style><div class="css-5fc025"><a aria-current="page" style="text-decoration:none;width:100%;color:inherit" class="" href="/zh/tidb/stable/character-set-and-collation"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">概述</div></div></a></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" id="left-nav-treeview-0-13-10-15-1" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-5fc025"><a style="text-decoration:none;width:100%;color:inherit" href="/zh/tidb/stable/character-set-gbk"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">GBK</div></div></a></div></div></div></li></div></div></ul></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" id="left-nav-treeview-0-13-10-16" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-snygwd"><a style="text-decoration:none;width:100%;color:inherit" href="/zh/tidb/stable/placement-rules-in-sql"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">Placement Rules in SQL</div></div></a></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-13-10-17" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-snygwd"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">系统表</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" id="left-nav-treeview-0-13-10-18" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-snygwd"><a style="text-decoration:none;width:100%;color:inherit" href="/zh/tidb/stable/metadata-lock"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">元数据锁</div></div></a></div></div></div></li></div></div></ul></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-13-11" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-kb2j4b"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">UI</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" id="left-nav-treeview-0-13-12" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-kb2j4b"><a style="text-decoration:none;width:100%;color:inherit" href="/zh/tidb/stable/telemetry"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">遥测</div></div></a></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" id="left-nav-treeview-0-13-13" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-kb2j4b"><a style="text-decoration:none;width:100%;color:inherit" href="/zh/tidb/stable/error-codes"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">错误码</div></div></a></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" id="left-nav-treeview-0-13-14" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-kb2j4b"><a style="text-decoration:none;width:100%;color:inherit" href="/zh/tidb/stable/schedule-replicas-by-topology-labels"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">通过拓扑 label 进行副本调度</div></div></a></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-13-15" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-kb2j4b"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">内部组件介绍</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li></div></div></ul></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-14" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-znl8a3"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">常见问题解答 (FAQ)</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" aria-expanded="false" id="left-nav-treeview-0-15" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-znl8a3"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">版本发布历史</div></div><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiTreeItem-ChevronRightIcon css-xjq79n" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ChevronRightIcon"><path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg></div></div></div></li><li class="MuiTreeItem-root css-1oy5rnm" role="treeitem" id="left-nav-treeview-0-16" tabindex="-1" style="margin-top:0.1875rem;margin-bottom:0.1875rem"><div class="css-khel7y MuiTreeItem-content" style="width:inherit"><div class="MuiTreeItem-iconContainer"/><div class="MuiTreeItem-label"><div class="css-znl8a3"><a style="text-decoration:none;width:100%;color:inherit" href="/zh/tidb/stable/glossary"><div class="MuiBox-root css-8atqhb"><div class="MuiTypography-root MuiTypography-body1 css-1hwyipb">术语表</div></div></a></div></div></div></li></ul></div></aside><style data-emotion="css sb2sd0">.css-sb2sd0{width:100%;}@media (min-width:1200px){.css-sb2sd0{max-width:calc(100% - 18.75rem);}}</style><main class="MuiBox-root css-sb2sd0"><style data-emotion="css 1rnnmjb">.css-1rnnmjb{max-width:1340px;width:100%;margin-left:auto;margin-right:auto;display:block;box-sizing:border-box;}</style><div class="MuiBox-root css-1rnnmjb"><style data-emotion="css 90fn5w">.css-90fn5w{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}@media (min-width:0px){.css-90fn5w{-webkit-flex-direction:column-reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse;}}@media (min-width:600px){.css-90fn5w{-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;}}</style><div class="css-90fn5w"><style data-emotion="css vofosd">.css-vofosd{padding:1.5rem 0;}@media (min-width:0px){.css-vofosd{width:100%;}}@media (min-width:600px){.css-vofosd{width:calc(100% - 17.5rem);}}</style><div class="MuiBox-root css-vofosd"><style data-emotion="css 1ekb41w">.css-1ekb41w{width:100%;margin-left:auto;box-sizing:border-box;margin-right:auto;display:block;padding-left:16px;padding-right:16px;}@media (min-width:600px){.css-1ekb41w{padding-left:24px;padding-right:24px;}}@media (min-width:1536px){.css-1ekb41w{max-width:1536px;}}</style><div class="MuiContainer-root MuiContainer-maxWidthXl doc-content css-1ekb41w"><div class="markdown-body MuiBox-root css-0"><h1 id="字符集和排序规则" style="position:relative"><a href="#%E5%AD%97%E7%AC%A6%E9%9B%86%E5%92%8C%E6%8E%92%E5%BA%8F%E8%A7%84%E5%88%99" aria-label="字符集和排序规则 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"/></svg></a>字符集和排序规则</h1><p>本文介绍了 TiDB 中支持的字符集和排序规则。</p><h2 id="字符集和排序规则的概念" style="position:relative"><a href="#%E5%AD%97%E7%AC%A6%E9%9B%86%E5%92%8C%E6%8E%92%E5%BA%8F%E8%A7%84%E5%88%99%E7%9A%84%E6%A6%82%E5%BF%B5" aria-label="字符集和排序规则的概念 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"/></svg></a>字符集和排序规则的概念</h2><p>字符集 (character set) 是符号与编码的集合。TiDB 中的默认字符集是 utf8mb4,与 MySQL 8.0 及更高版本中的默认字符集匹配。</p><p>排序规则 (collation) 是在字符集中比较字符以及字符排序顺序的规则。例如,在二进制排序规则中,比较 <code>A</code> 和 <code>a</code> 的结果是不一样的:</p><pre><code class="hljs language-sql"><style data-emotion="css 1qhimia">.css-1qhimia{margin-right:3rem;overflow:auto;}</style><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">SET</span> NAMES utf8mb4 <span class="hljs-keyword">COLLATE</span> utf8mb4_bin; <span class="hljs-keyword">SELECT</span> <span class="hljs-string">'A'</span> <span class="hljs-operator">=</span> <span class="hljs-string">'a'</span>; <span class="hljs-keyword">SET</span> NAMES utf8mb4 <span class="hljs-keyword">COLLATE</span> utf8mb4_general_ci; <span class="hljs-keyword">SELECT</span> <span class="hljs-string">'A'</span> <span class="hljs-operator">=</span> <span class="hljs-string">'a'</span>; </div><style data-emotion="css ux9q70">.css-ux9q70{text-align:center;-webkit-flex:0 0 auto;-ms-flex:0 0 auto;flex:0 0 auto;font-size:1.5rem;padding:8px;border-radius:50%;overflow:visible;color:rgba(0, 0, 0, 0.54);-webkit-transition:background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;padding:5px;font-size:1.125rem;top:0.625rem;right:2.4rem;background:transparent;border:unset;}.css-ux9q70:hover{background-color:rgba(0, 0, 0, 0.04);}@media (hover: none){.css-ux9q70:hover{background-color:transparent;}}.css-ux9q70.Mui-disabled{background-color:transparent;color:rgba(0, 0, 0, 0.26);}</style><style data-emotion="css 1rmx1rm">.css-1rmx1rm{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;position:relative;box-sizing:border-box;-webkit-tap-highlight-color:transparent;background-color:transparent;outline:0;border:0;margin:0;border-radius:0;padding:0;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;-moz-appearance:none;-webkit-appearance:none;-webkit-text-decoration:none;text-decoration:none;color:inherit;text-align:center;-webkit-flex:0 0 auto;-ms-flex:0 0 auto;flex:0 0 auto;font-size:1.5rem;padding:8px;border-radius:50%;overflow:visible;color:rgba(0, 0, 0, 0.54);-webkit-transition:background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;padding:5px;font-size:1.125rem;top:0.625rem;right:2.4rem;background:transparent;border:unset;}.css-1rmx1rm::-moz-focus-inner{border-style:none;}.css-1rmx1rm.Mui-disabled{pointer-events:none;cursor:default;}@media print{.css-1rmx1rm{-webkit-print-color-adjust:exact;color-adjust:exact;}}.css-1rmx1rm:hover{background-color:rgba(0, 0, 0, 0.04);}@media (hover: none){.css-1rmx1rm:hover{background-color:transparent;}}.css-1rmx1rm.Mui-disabled{background-color:transparent;color:rgba(0, 0, 0, 0.26);}</style><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><style data-emotion="css 1cw4hi4">.css-1cw4hi4{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:1em;height:1em;display:inline-block;fill:currentColor;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;font-size:inherit;}</style><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><style data-emotion="css 1e2dcm1">.css-1e2dcm1{z-index:1500;pointer-events:none;}</style><style data-emotion="css okvapm">.css-okvapm{z-index:1500;pointer-events:none;}</style><style data-emotion="css rnn29l">.css-rnn29l{text-align:center;-webkit-flex:0 0 auto;-ms-flex:0 0 auto;flex:0 0 auto;font-size:1.5rem;padding:8px;border-radius:50%;overflow:visible;color:rgba(0, 0, 0, 0.54);-webkit-transition:background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;padding:5px;font-size:1.125rem;top:0.625rem;right:0.625rem;background:transparent;border:unset;}.css-rnn29l:hover{background-color:rgba(0, 0, 0, 0.04);}@media (hover: none){.css-rnn29l:hover{background-color:transparent;}}.css-rnn29l.Mui-disabled{background-color:transparent;color:rgba(0, 0, 0, 0.26);}</style><style data-emotion="css fxo539">.css-fxo539{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;position:relative;box-sizing:border-box;-webkit-tap-highlight-color:transparent;background-color:transparent;outline:0;border:0;margin:0;border-radius:0;padding:0;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;-moz-appearance:none;-webkit-appearance:none;-webkit-text-decoration:none;text-decoration:none;color:inherit;text-align:center;-webkit-flex:0 0 auto;-ms-flex:0 0 auto;flex:0 0 auto;font-size:1.5rem;padding:8px;border-radius:50%;overflow:visible;color:rgba(0, 0, 0, 0.54);-webkit-transition:background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;padding:5px;font-size:1.125rem;top:0.625rem;right:0.625rem;background:transparent;border:unset;}.css-fxo539::-moz-focus-inner{border-style:none;}.css-fxo539.Mui-disabled{pointer-events:none;cursor:default;}@media print{.css-fxo539{-webkit-print-color-adjust:exact;color-adjust:exact;}}.css-fxo539:hover{background-color:rgba(0, 0, 0, 0.04);}@media (hover: none){.css-fxo539:hover{background-color:transparent;}}.css-fxo539.Mui-disabled{background-color:transparent;color:rgba(0, 0, 0, 0.26);}</style><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">SELECT</span> <span class="hljs-string">'A'</span> <span class="hljs-operator">=</span> <span class="hljs-string">'a'</span>; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-operator">+</span><span class="hljs-comment">-----------+</span> <span class="hljs-operator">|</span> <span class="hljs-string">'A'</span> <span class="hljs-operator">=</span> <span class="hljs-string">'a'</span> <span class="hljs-operator">|</span> <span class="hljs-operator">+</span><span class="hljs-comment">-----------+</span> <span class="hljs-operator">|</span> <span class="hljs-number">0</span> <span class="hljs-operator">|</span> <span class="hljs-operator">+</span><span class="hljs-comment">-----------+</span> <span class="hljs-number">1</span> <span class="hljs-type">row</span> <span class="hljs-keyword">in</span> <span class="hljs-keyword">set</span> (<span class="hljs-number">0.00</span> sec) </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">SET</span> NAMES utf8mb4 <span class="hljs-keyword">COLLATE</span> utf8mb4_general_ci; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">Query OK, <span class="hljs-number">0</span> <span class="hljs-keyword">rows</span> affected (<span class="hljs-number">0.00</span> sec) </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">SELECT</span> <span class="hljs-string">'A'</span> <span class="hljs-operator">=</span> <span class="hljs-string">'a'</span>; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-operator">+</span><span class="hljs-comment">-----------+</span> <span class="hljs-operator">|</span> <span class="hljs-string">'A'</span> <span class="hljs-operator">=</span> <span class="hljs-string">'a'</span> <span class="hljs-operator">|</span> <span class="hljs-operator">+</span><span class="hljs-comment">-----------+</span> <span class="hljs-operator">|</span> <span class="hljs-number">1</span> <span class="hljs-operator">|</span> <span class="hljs-operator">+</span><span class="hljs-comment">-----------+</span> <span class="hljs-number">1</span> <span class="hljs-type">row</span> <span class="hljs-keyword">in</span> <span class="hljs-keyword">set</span> (<span class="hljs-number">0.00</span> sec) </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><p>TiDB 默认使用二进制排序规则。这一点与 MySQL 不同,MySQL 默认使用不区分大小写的排序规则。</p><h2 id="支持的字符集和排序规则" style="position:relative"><a href="#%E6%94%AF%E6%8C%81%E7%9A%84%E5%AD%97%E7%AC%A6%E9%9B%86%E5%92%8C%E6%8E%92%E5%BA%8F%E8%A7%84%E5%88%99" aria-label="支持的字符集和排序规则 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"/></svg></a>支持的字符集和排序规则</h2><p>目前 TiDB 支持以下字符集:</p><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">SHOW</span> <span class="hljs-type">CHARACTER</span> <span class="hljs-keyword">SET</span>; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-operator">+</span><span class="hljs-comment">---------+-------------------------------------+-------------------+--------+</span> <span class="hljs-operator">|</span> Charset <span class="hljs-operator">|</span> Description <span class="hljs-operator">|</span> <span class="hljs-keyword">Default</span> <span class="hljs-keyword">collation</span> <span class="hljs-operator">|</span> Maxlen <span class="hljs-operator">|</span> <span class="hljs-operator">+</span><span class="hljs-comment">---------+-------------------------------------+-------------------+--------+</span> <span class="hljs-operator">|</span> ascii <span class="hljs-operator">|</span> US ASCII <span class="hljs-operator">|</span> ascii_bin <span class="hljs-operator">|</span> <span class="hljs-number">1</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> <span class="hljs-type">binary</span> <span class="hljs-operator">|</span> <span class="hljs-type">binary</span> <span class="hljs-operator">|</span> <span class="hljs-type">binary</span> <span class="hljs-operator">|</span> <span class="hljs-number">1</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> gbk <span class="hljs-operator">|</span> Chinese Internal Code Specification <span class="hljs-operator">|</span> gbk_bin <span class="hljs-operator">|</span> <span class="hljs-number">2</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> latin1 <span class="hljs-operator">|</span> Latin1 <span class="hljs-operator">|</span> latin1_bin <span class="hljs-operator">|</span> <span class="hljs-number">1</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> utf8 <span class="hljs-operator">|</span> UTF<span class="hljs-number">-8</span> Unicode <span class="hljs-operator">|</span> utf8_bin <span class="hljs-operator">|</span> <span class="hljs-number">3</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> utf8mb4 <span class="hljs-operator">|</span> UTF<span class="hljs-number">-8</span> Unicode <span class="hljs-operator">|</span> utf8mb4_bin <span class="hljs-operator">|</span> <span class="hljs-number">4</span> <span class="hljs-operator">|</span> <span class="hljs-operator">+</span><span class="hljs-comment">---------+-------------------------------------+-------------------+--------+</span> <span class="hljs-number">6</span> <span class="hljs-keyword">rows</span> <span class="hljs-keyword">in</span> <span class="hljs-keyword">set</span> (<span class="hljs-number">0.00</span> sec) </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><p>TiDB 支持以下排序规则:</p><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">SHOW</span> <span class="hljs-keyword">COLLATION</span>; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-operator">+</span><span class="hljs-comment">--------------------+---------+------+---------+----------+---------+</span> <span class="hljs-operator">|</span> <span class="hljs-keyword">Collation</span> <span class="hljs-operator">|</span> Charset <span class="hljs-operator">|</span> Id <span class="hljs-operator">|</span> <span class="hljs-keyword">Default</span> <span class="hljs-operator">|</span> Compiled <span class="hljs-operator">|</span> Sortlen <span class="hljs-operator">|</span> <span class="hljs-operator">+</span><span class="hljs-comment">--------------------+---------+------+---------+----------+---------+</span> <span class="hljs-operator">|</span> ascii_bin <span class="hljs-operator">|</span> ascii <span class="hljs-operator">|</span> <span class="hljs-number">65</span> <span class="hljs-operator">|</span> Yes <span class="hljs-operator">|</span> Yes <span class="hljs-operator">|</span> <span class="hljs-number">1</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> <span class="hljs-type">binary</span> <span class="hljs-operator">|</span> <span class="hljs-type">binary</span> <span class="hljs-operator">|</span> <span class="hljs-number">63</span> <span class="hljs-operator">|</span> Yes <span class="hljs-operator">|</span> Yes <span class="hljs-operator">|</span> <span class="hljs-number">1</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> gbk_bin <span class="hljs-operator">|</span> gbk <span class="hljs-operator">|</span> <span class="hljs-number">87</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> Yes <span class="hljs-operator">|</span> <span class="hljs-number">1</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> gbk_chinese_ci <span class="hljs-operator">|</span> gbk <span class="hljs-operator">|</span> <span class="hljs-number">28</span> <span class="hljs-operator">|</span> Yes <span class="hljs-operator">|</span> Yes <span class="hljs-operator">|</span> <span class="hljs-number">1</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> latin1_bin <span class="hljs-operator">|</span> latin1 <span class="hljs-operator">|</span> <span class="hljs-number">47</span> <span class="hljs-operator">|</span> Yes <span class="hljs-operator">|</span> Yes <span class="hljs-operator">|</span> <span class="hljs-number">1</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> utf8_bin <span class="hljs-operator">|</span> utf8 <span class="hljs-operator">|</span> <span class="hljs-number">83</span> <span class="hljs-operator">|</span> Yes <span class="hljs-operator">|</span> Yes <span class="hljs-operator">|</span> <span class="hljs-number">1</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> utf8_general_ci <span class="hljs-operator">|</span> utf8 <span class="hljs-operator">|</span> <span class="hljs-number">33</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> Yes <span class="hljs-operator">|</span> <span class="hljs-number">1</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> utf8_unicode_ci <span class="hljs-operator">|</span> utf8 <span class="hljs-operator">|</span> <span class="hljs-number">192</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> Yes <span class="hljs-operator">|</span> <span class="hljs-number">1</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> utf8mb4_bin <span class="hljs-operator">|</span> utf8mb4 <span class="hljs-operator">|</span> <span class="hljs-number">46</span> <span class="hljs-operator">|</span> Yes <span class="hljs-operator">|</span> Yes <span class="hljs-operator">|</span> <span class="hljs-number">1</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> utf8mb4_general_ci <span class="hljs-operator">|</span> utf8mb4 <span class="hljs-operator">|</span> <span class="hljs-number">45</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> Yes <span class="hljs-operator">|</span> <span class="hljs-number">1</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> utf8mb4_unicode_ci <span class="hljs-operator">|</span> utf8mb4 <span class="hljs-operator">|</span> <span class="hljs-number">224</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> Yes <span class="hljs-operator">|</span> <span class="hljs-number">1</span> <span class="hljs-operator">|</span> <span class="hljs-operator">+</span><span class="hljs-comment">--------------------+---------+------+---------+----------+---------+</span> <span class="hljs-number">11</span> <span class="hljs-keyword">rows</span> <span class="hljs-keyword">in</span> <span class="hljs-keyword">set</span> (<span class="hljs-number">0.00</span> sec) </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><style data-emotion="css 1weqspv">.css-1weqspv{padding-top:0.5rem;padding-bottom:0.5rem;}.css-1weqspv .MuiAlert-message p{margin-bottom:0px;margin-top:0px;}</style><div class="MuiBox-root css-1weqspv"><style data-emotion="css 1rl2db2">.css-1rl2db2{font-size:0.875rem;line-height:1.25rem;font-family:"Helvetica Neue","sans-serif";font-weight:400;font-style:normal;color:rgb(95, 33, 32);background-color:rgb(253, 237, 237);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;padding:6px 16px;}.css-1rl2db2 .MuiAlert-icon{color:#ef5350;}</style><style data-emotion="css 21rxh6">.css-21rxh6{background-color:#fff;color:rgba(0, 0, 0, 0.87);-webkit-transition:box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;border-radius:4px;box-shadow:none;font-size:0.875rem;line-height:1.25rem;font-family:"Helvetica Neue","sans-serif";font-weight:400;font-style:normal;color:rgb(95, 33, 32);background-color:rgb(253, 237, 237);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;padding:6px 16px;}.css-21rxh6 .MuiAlert-icon{color:#ef5350;}</style><div class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation0 MuiAlert-root MuiAlert-standardError MuiAlert-standard css-21rxh6" role="alert"><style data-emotion="css 1l54tgj">.css-1l54tgj{margin-right:12px;padding:7px 0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;font-size:22px;opacity:0.9;}</style><div class="MuiAlert-icon css-1l54tgj"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ErrorOutlineIcon"><path d="M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/></svg></div><style data-emotion="css 1xsto0d">.css-1xsto0d{padding:8px 0;min-width:0;overflow:auto;}</style><div class="MuiAlert-message css-1xsto0d"><style data-emotion="css 1h2y6o4">.css-1h2y6o4{font-weight:500;margin-top:-2px;}</style><style data-emotion="css 17ioyuk">.css-17ioyuk{margin:0;font-size:1rem;line-height:1.5rem;font-family:"Helvetica Neue","sans-serif";font-weight:400;font-style:normal;color:#666666;margin-bottom:0.35em;font-weight:500;margin-top:-2px;}</style><div class="MuiTypography-root MuiTypography-body1 MuiTypography-gutterBottom MuiAlertTitle-root css-17ioyuk">警告</div><p>TiDB 会错误地将 <code>latin1</code> 视为 <code>utf8</code> 的子集。当用户存储不同于 <code>latin1</code> 和 <code>utf8</code> 编码的字符时,可能会导致意外情况出现。因此强烈建议使用 <code>utf8mb4</code> 字符集。详情参阅 <a href="https://github.com/pingcap/tidb/issues/18955" target="_blank" referrerpolicy="no-referrer-when-downgrade">TiDB #18955</a>。</p></div></div></div><div class="MuiBox-root css-1weqspv"><style data-emotion="css 17zlexa">.css-17zlexa{font-size:0.875rem;line-height:1.25rem;font-family:"Helvetica Neue","sans-serif";font-weight:400;font-style:normal;color:rgb(1, 67, 97);background-color:rgb(229, 246, 253);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;padding:6px 16px;}.css-17zlexa .MuiAlert-icon{color:#03a9f4;}</style><style data-emotion="css 152gid5">.css-152gid5{background-color:#fff;color:rgba(0, 0, 0, 0.87);-webkit-transition:box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;border-radius:4px;box-shadow:none;font-size:0.875rem;line-height:1.25rem;font-family:"Helvetica Neue","sans-serif";font-weight:400;font-style:normal;color:rgb(1, 67, 97);background-color:rgb(229, 246, 253);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;padding:6px 16px;}.css-152gid5 .MuiAlert-icon{color:#03a9f4;}</style><div class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation0 MuiAlert-root MuiAlert-standardInfo MuiAlert-standard css-152gid5" role="alert"><div class="MuiAlert-icon css-1l54tgj"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="InfoOutlinedIcon"><path d="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"/></svg></div><div class="MuiAlert-message css-1xsto0d"><div class="MuiTypography-root MuiTypography-body1 MuiTypography-gutterBottom MuiAlertTitle-root css-17ioyuk">注意</div><p>TiDB 中的默认排序规则(后缀为 <code>_bin</code> 的二进制排序规则)与 <a href="https://dev.mysql.com/doc/refman/8.0/en/charset-charsets.html" target="_blank" referrerpolicy="no-referrer-when-downgrade">MySQL 中的默认排序规则</a>不同,后者通常是一般排序规则,后缀为 <code>_general_ci</code>。当用户指定了显式字符集,但依赖于待选的隐式默认排序规则时,这个差异可能导致兼容性问题。</p></div></div></div><p>利用以下的语句可以查看字符集对应的排序规则(以下是<a href="#%E6%96%B0%E6%A1%86%E6%9E%B6%E4%B8%8B%E7%9A%84%E6%8E%92%E5%BA%8F%E8%A7%84%E5%88%99%E6%94%AF%E6%8C%81">新的排序规则框架</a>)下的结果:</p><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">SHOW</span> <span class="hljs-keyword">COLLATION</span> <span class="hljs-keyword">WHERE</span> Charset <span class="hljs-operator">=</span> <span class="hljs-string">'utf8mb4'</span>; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-operator">+</span><span class="hljs-comment">--------------------+---------+------+---------+----------+---------+</span> <span class="hljs-operator">|</span> <span class="hljs-keyword">Collation</span> <span class="hljs-operator">|</span> Charset <span class="hljs-operator">|</span> Id <span class="hljs-operator">|</span> <span class="hljs-keyword">Default</span> <span class="hljs-operator">|</span> Compiled <span class="hljs-operator">|</span> Sortlen <span class="hljs-operator">|</span> <span class="hljs-operator">+</span><span class="hljs-comment">--------------------+---------+------+---------+----------+---------+</span> <span class="hljs-operator">|</span> utf8mb4_bin <span class="hljs-operator">|</span> utf8mb4 <span class="hljs-operator">|</span> <span class="hljs-number">46</span> <span class="hljs-operator">|</span> Yes <span class="hljs-operator">|</span> Yes <span class="hljs-operator">|</span> <span class="hljs-number">1</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> utf8mb4_general_ci <span class="hljs-operator">|</span> utf8mb4 <span class="hljs-operator">|</span> <span class="hljs-number">45</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> Yes <span class="hljs-operator">|</span> <span class="hljs-number">1</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> utf8mb4_unicode_ci <span class="hljs-operator">|</span> utf8mb4 <span class="hljs-operator">|</span> <span class="hljs-number">224</span> <span class="hljs-operator">|</span> <span class="hljs-operator">|</span> Yes <span class="hljs-operator">|</span> <span class="hljs-number">1</span> <span class="hljs-operator">|</span> <span class="hljs-operator">+</span><span class="hljs-comment">--------------------+---------+------+---------+----------+---------+</span> <span class="hljs-number">3</span> <span class="hljs-keyword">rows</span> <span class="hljs-keyword">in</span> <span class="hljs-keyword">set</span> (<span class="hljs-number">0.00</span> sec) </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><p>TiDB 对 GBK 字符集的支持详情见 <a href="/zh/tidb/stable/character-set-gbk">GBK</a>。</p><h2 id="tidb-中的-utf8-和-utf8mb4" style="position:relative"><a href="#tidb-%E4%B8%AD%E7%9A%84-utf8-%E5%92%8C-utf8mb4" aria-label="tidb 中的 utf8 和 utf8mb4 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"/></svg></a>TiDB 中的 <code>utf8</code> 和 <code>utf8mb4</code></h2><p>MySQL 限制字符集 <code>utf8</code> 为最多 3 个字节。这足以存储在基本多语言平面 (BMP) 中的字符,但不足以存储表情符号 (emoji) 等字符。因此,建议改用字符集<code>utf8mb4</code>。</p><p>默认情况下,TiDB 同样限制字符集 <code>utf8</code> 为最多 3 个字节,以确保 TiDB 中创建的数据可以在 MySQL 中顺利恢复。你可以禁用此功能,方法是将系统变量 <a href="/zh/tidb/stable/system-variables#tidb_check_mb4_value_in_utf8"><code>tidb_check_mb4_value_in_utf8</code></a> 的值更改为 <code>OFF</code>。</p><p>以下示例演示了在表中插入 4 字节的表情符号字符(emoji 字符)时的默认行为。<code>utf8</code> 字符集下 <code>INSERT</code> 语句不能执行,<code>utf8mb4</code> 字符集下可以执行 <code>INSERT</code> 语句:</p><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">CREATE</span> <span class="hljs-keyword">TABLE</span> utf8_test ( c <span class="hljs-type">char</span>(<span class="hljs-number">1</span>) <span class="hljs-keyword">NOT</span> <span class="hljs-keyword">NULL</span> ) <span class="hljs-type">CHARACTER</span> <span class="hljs-keyword">SET</span> utf8; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">Query OK, <span class="hljs-number">0</span> <span class="hljs-keyword">rows</span> affected (<span class="hljs-number">0.09</span> sec) </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">CREATE</span> <span class="hljs-keyword">TABLE</span> utf8m4_test ( c <span class="hljs-type">char</span>(<span class="hljs-number">1</span>) <span class="hljs-keyword">NOT</span> <span class="hljs-keyword">NULL</span> ) <span class="hljs-type">CHARACTER</span> <span class="hljs-keyword">SET</span> utf8mb4; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">Query OK, <span class="hljs-number">0</span> <span class="hljs-keyword">rows</span> affected (<span class="hljs-number">0.09</span> sec) </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">INSERT</span> <span class="hljs-keyword">INTO</span> utf8_test <span class="hljs-keyword">VALUES</span> (<span class="hljs-string">'😉'</span>); </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">ERROR <span class="hljs-number">1366</span> (HY000): incorrect utf8 <span class="hljs-keyword">value</span> f09f9889(😉) <span class="hljs-keyword">for</span> <span class="hljs-keyword">column</span> c </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">INSERT</span> <span class="hljs-keyword">INTO</span> utf8m4_test <span class="hljs-keyword">VALUES</span> (<span class="hljs-string">'😉'</span>); </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">Query OK, <span class="hljs-number">1</span> <span class="hljs-type">row</span> affected (<span class="hljs-number">0.02</span> sec) </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">SELECT</span> <span class="hljs-keyword">char_length</span>(c), length(c), c <span class="hljs-keyword">FROM</span> utf8_test; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">Empty</span> <span class="hljs-keyword">set</span> (<span class="hljs-number">0.01</span> sec) </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">SELECT</span> <span class="hljs-keyword">char_length</span>(c), length(c), c <span class="hljs-keyword">FROM</span> utf8m4_test; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-operator">+</span><span class="hljs-comment">----------------+-----------+------+</span> <span class="hljs-operator">|</span> <span class="hljs-keyword">char_length</span>(c) <span class="hljs-operator">|</span> length(c) <span class="hljs-operator">|</span> c <span class="hljs-operator">|</span> <span class="hljs-operator">+</span><span class="hljs-comment">----------------+-----------+------+</span> <span class="hljs-operator">|</span> <span class="hljs-number">1</span> <span class="hljs-operator">|</span> <span class="hljs-number">4</span> <span class="hljs-operator">|</span> 😉 <span class="hljs-operator">|</span> <span class="hljs-operator">+</span><span class="hljs-comment">----------------+-----------+------+</span> <span class="hljs-number">1</span> <span class="hljs-type">row</span> <span class="hljs-keyword">in</span> <span class="hljs-keyword">set</span> (<span class="hljs-number">0.00</span> sec) </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><h2 id="不同范围的字符集和排序规则" style="position:relative"><a href="#%E4%B8%8D%E5%90%8C%E8%8C%83%E5%9B%B4%E7%9A%84%E5%AD%97%E7%AC%A6%E9%9B%86%E5%92%8C%E6%8E%92%E5%BA%8F%E8%A7%84%E5%88%99" aria-label="不同范围的字符集和排序规则 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"/></svg></a>不同范围的字符集和排序规则</h2><p>字符集和排序规则可以在设置在不同的层次。</p><h3 id="数据库的字符集和排序规则" style="position:relative"><a href="#%E6%95%B0%E6%8D%AE%E5%BA%93%E7%9A%84%E5%AD%97%E7%AC%A6%E9%9B%86%E5%92%8C%E6%8E%92%E5%BA%8F%E8%A7%84%E5%88%99" aria-label="数据库的字符集和排序规则 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"/></svg></a>数据库的字符集和排序规则</h3><p>每个数据库都有相应的字符集和排序规则。数据库的字符集和排序规则可以通过以下语句来设置:</p><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">CREATE</span> DATABASE db_name [[<span class="hljs-keyword">DEFAULT</span>] <span class="hljs-type">CHARACTER</span> <span class="hljs-keyword">SET</span> charset_name] [[<span class="hljs-keyword">DEFAULT</span>] <span class="hljs-keyword">COLLATE</span> collation_name] <span class="hljs-keyword">ALTER</span> DATABASE db_name [[<span class="hljs-keyword">DEFAULT</span>] <span class="hljs-type">CHARACTER</span> <span class="hljs-keyword">SET</span> charset_name] [[<span class="hljs-keyword">DEFAULT</span>] <span class="hljs-keyword">COLLATE</span> collation_name] </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><p>在这里 <code>DATABASE</code> 可以跟 <code>SCHEMA</code> 互换使用。</p><p>不同的数据库之间可以使用不一样的字符集和排序规则。</p><p>通过系统变量 <code>character_set_database</code> 和 <code>collation_database</code> 可以查看到当前数据库的字符集以及排序规则:</p><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">CREATE</span> SCHEMA test1 <span class="hljs-type">CHARACTER</span> <span class="hljs-keyword">SET</span> utf8mb4 <span class="hljs-keyword">COLLATE</span> utf8mb4_general_ci; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">Query OK, <span class="hljs-number">0</span> <span class="hljs-keyword">rows</span> affected (<span class="hljs-number">0.09</span> sec) </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">USE test1; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">Database changed </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">SELECT</span> @<span class="hljs-variable">@character</span>_set_database, @<span class="hljs-variable">@collation</span>_database; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-operator">+</span><span class="hljs-comment">--------------------------|----------------------+</span> <span class="hljs-operator">|</span> @<span class="hljs-variable">@character</span>_set_database <span class="hljs-operator">|</span> @<span class="hljs-variable">@collation</span>_database <span class="hljs-operator">|</span> <span class="hljs-operator">+</span><span class="hljs-comment">--------------------------|----------------------+</span> <span class="hljs-operator">|</span> utf8mb4 <span class="hljs-operator">|</span> utf8mb4_general_ci <span class="hljs-operator">|</span> <span class="hljs-operator">+</span><span class="hljs-comment">--------------------------|----------------------+</span> <span class="hljs-number">1</span> <span class="hljs-type">row</span> <span class="hljs-keyword">in</span> <span class="hljs-keyword">set</span> (<span class="hljs-number">0.00</span> sec) </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">CREATE</span> SCHEMA test2 <span class="hljs-type">CHARACTER</span> <span class="hljs-keyword">SET</span> latin1 <span class="hljs-keyword">COLLATE</span> latin1_bin; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">Query OK, <span class="hljs-number">0</span> <span class="hljs-keyword">rows</span> affected (<span class="hljs-number">0.09</span> sec) </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">USE test2; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">Database changed </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">SELECT</span> @<span class="hljs-variable">@character</span>_set_database, @<span class="hljs-variable">@collation</span>_database; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-operator">+</span><span class="hljs-comment">--------------------------|----------------------+</span> <span class="hljs-operator">|</span> @<span class="hljs-variable">@character</span>_set_database <span class="hljs-operator">|</span> @<span class="hljs-variable">@collation</span>_database <span class="hljs-operator">|</span> <span class="hljs-operator">+</span><span class="hljs-comment">--------------------------|----------------------+</span> <span class="hljs-operator">|</span> latin1 <span class="hljs-operator">|</span> latin1_bin <span class="hljs-operator">|</span> <span class="hljs-operator">+</span><span class="hljs-comment">--------------------------|----------------------+</span> <span class="hljs-number">1</span> <span class="hljs-type">row</span> <span class="hljs-keyword">in</span> <span class="hljs-keyword">set</span> (<span class="hljs-number">0.00</span> sec) </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><p>在 INFORMATION_SCHEMA 中也可以查看到这两个值:</p><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">SELECT</span> DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME <span class="hljs-keyword">FROM</span> INFORMATION_SCHEMA.SCHEMATA <span class="hljs-keyword">WHERE</span> SCHEMA_NAME <span class="hljs-operator">=</span> <span class="hljs-string">'db_name'</span>; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><h3 id="表的字符集和排序规则" style="position:relative"><a href="#%E8%A1%A8%E7%9A%84%E5%AD%97%E7%AC%A6%E9%9B%86%E5%92%8C%E6%8E%92%E5%BA%8F%E8%A7%84%E5%88%99" aria-label="表的字符集和排序规则 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"/></svg></a>表的字符集和排序规则</h3><p>表的字符集和排序规则可以通过以下语句来设置:</p><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">CREATE</span> <span class="hljs-keyword">TABLE</span> tbl_name (column_list) [[<span class="hljs-keyword">DEFAULT</span>] <span class="hljs-type">CHARACTER</span> <span class="hljs-keyword">SET</span> charset_name] [<span class="hljs-keyword">COLLATE</span> collation_name]] <span class="hljs-keyword">ALTER</span> <span class="hljs-keyword">TABLE</span> tbl_name [[<span class="hljs-keyword">DEFAULT</span>] <span class="hljs-type">CHARACTER</span> <span class="hljs-keyword">SET</span> charset_name] [<span class="hljs-keyword">COLLATE</span> collation_name] </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><p>例如:</p><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">CREATE</span> <span class="hljs-keyword">TABLE</span> t1(a <span class="hljs-type">int</span>) <span class="hljs-type">CHARACTER</span> <span class="hljs-keyword">SET</span> utf8mb4 <span class="hljs-keyword">COLLATE</span> utf8mb4_general_ci; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">Query OK, <span class="hljs-number">0</span> <span class="hljs-keyword">rows</span> affected (<span class="hljs-number">0.08</span> sec) </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><p>如果表的字符集和排序规则没有设置,那么数据库的字符集和排序规则就作为其默认值。</p><h3 id="列的字符集和排序规则" style="position:relative"><a href="#%E5%88%97%E7%9A%84%E5%AD%97%E7%AC%A6%E9%9B%86%E5%92%8C%E6%8E%92%E5%BA%8F%E8%A7%84%E5%88%99" aria-label="列的字符集和排序规则 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"/></svg></a>列的字符集和排序规则</h3><p>列的字符集和排序规则的语法如下:</p><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">col_name {<span class="hljs-type">CHAR</span> <span class="hljs-operator">|</span> <span class="hljs-type">VARCHAR</span> <span class="hljs-operator">|</span> TEXT} (col_length) [<span class="hljs-type">CHARACTER</span> <span class="hljs-keyword">SET</span> charset_name] [<span class="hljs-keyword">COLLATE</span> collation_name] col_name {ENUM <span class="hljs-operator">|</span> <span class="hljs-keyword">SET</span>} (val_list) [<span class="hljs-type">CHARACTER</span> <span class="hljs-keyword">SET</span> charset_name] [<span class="hljs-keyword">COLLATE</span> collation_name] </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><p>如果列的字符集和排序规则没有设置,那么表的字符集和排序规则就作为其默认值。</p><h3 id="字符串的字符集和排序规则" style="position:relative"><a href="#%E5%AD%97%E7%AC%A6%E4%B8%B2%E7%9A%84%E5%AD%97%E7%AC%A6%E9%9B%86%E5%92%8C%E6%8E%92%E5%BA%8F%E8%A7%84%E5%88%99" aria-label="字符串的字符集和排序规则 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"/></svg></a>字符串的字符集和排序规则</h3><p>每一个字符串都对应一个字符集和一个排序规则,在使用字符串时指此选项可选,如下:</p><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">[_charset_name]<span class="hljs-string">'string'</span> [<span class="hljs-keyword">COLLATE</span> collation_name] </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><p>示例如下:</p><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">SELECT</span> <span class="hljs-string">'string'</span>; <span class="hljs-keyword">SELECT</span> _utf8mb4<span class="hljs-string">'string'</span>; <span class="hljs-keyword">SELECT</span> _utf8mb4<span class="hljs-string">'string'</span> <span class="hljs-keyword">COLLATE</span> utf8mb4_general_ci; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><p>规则如下:</p><ul><li>规则 1:如果指定了 <code>CHARACTER SET charset_name</code> 和 <code>COLLATE collation_name</code>,则直接使用 <code>charset_name</code> 字符集和 <code>collation_name</code> 排序规则。</li><li>规则 2:如果指定了 <code>CHARACTER SET charset_name</code> 且未指定 <code>COLLATE collation_name</code>,则使用 <code>charset_name</code> 字符集和 <code>charset_name</code> 对应的默认排序规则。</li><li>规则 3:如果 <code>CHARACTER SET charset_name</code> 和 <code>COLLATE collation_name</code> 都未指定,则使用 <code>character_set_connection</code> 和 <code>collation_connection</code> 系统变量给出的字符集和排序规则。</li></ul><h3 id="客户端连接的字符集和排序规则" style="position:relative"><a href="#%E5%AE%A2%E6%88%B7%E7%AB%AF%E8%BF%9E%E6%8E%A5%E7%9A%84%E5%AD%97%E7%AC%A6%E9%9B%86%E5%92%8C%E6%8E%92%E5%BA%8F%E8%A7%84%E5%88%99" aria-label="客户端连接的字符集和排序规则 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"/></svg></a>客户端连接的字符集和排序规则</h3><ul><li>服务器的字符集和排序规则可以通过系统变量 <code>character_set_server</code> 和 <code>collation_server</code> 获取。</li><li>数据库的字符集和排序规则可以通过环境变量 <code>character_set_database</code> 和 <code>collation_database</code> 获取。</li></ul><p>对于每一个客户端的连接,也有相应的变量表示字符集和排序规则:<code>character_set_connection</code> 和 <code>collation_connection</code>。</p><p><code>character_set_client</code> 代表客户端的字符集。在返回结果前,服务端会把结果根据 <code>character_set_results</code> 转换成对应的字符集,包括结果的元信息等。</p><p>可以用以下的语句来影响这些跟客户端相关的字符集变量:</p><ul><li><p><code>SET NAMES 'charset_name' [COLLATE 'collation_name']</code></p><p> <code>SET NAMES</code> 用来设定客户端会在之后的请求中使用的字符集。<code>SET NAMES utf8mb4</code> 表示客户端会在接下来的请求中,都使用 utf8mb4 字符集。服务端也会在之后返回结果的时候使用 utf8mb4 字符集。<code>SET NAMES 'charset_name'</code> 语句其实等于下面语句的组合:</p><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">SET</span> character_set_client <span class="hljs-operator">=</span> charset_name; <span class="hljs-keyword">SET</span> character_set_results <span class="hljs-operator">=</span> charset_name; <span class="hljs-keyword">SET</span> character_set_connection <span class="hljs-operator">=</span> charset_name; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><p> <code>COLLATE</code> 是可选的,如果没有提供,将会用 <code>charset_name</code> 对应的默认排序规则设置 <code>collation_connection</code>。</p></li><li><p><code>SET CHARACTER SET 'charset_name'</code></p><p> 跟 <code>SET NAMES</code> 类似,等价于下面语句的组合:</p><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">SET</span> character_set_client <span class="hljs-operator">=</span> charset_name; <span class="hljs-keyword">SET</span> character_set_results <span class="hljs-operator">=</span> charset_name; <span class="hljs-keyword">SET</span> charset_connection <span class="hljs-operator">=</span> @<span class="hljs-variable">@charset</span>_database; <span class="hljs-keyword">SET</span> collation_connection <span class="hljs-operator">=</span> @<span class="hljs-variable">@collation</span>_database; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre></li></ul><h2 id="服务器数据库表列字符串的字符集和排序规则的优先级" style="position:relative"><a href="#%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%95%B0%E6%8D%AE%E5%BA%93%E8%A1%A8%E5%88%97%E5%AD%97%E7%AC%A6%E4%B8%B2%E7%9A%84%E5%AD%97%E7%AC%A6%E9%9B%86%E5%92%8C%E6%8E%92%E5%BA%8F%E8%A7%84%E5%88%99%E7%9A%84%E4%BC%98%E5%85%88%E7%BA%A7" aria-label="服务器数据库表列字符串的字符集和排序规则的优先级 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"/></svg></a>服务器、数据库、表、列、字符串的字符集和排序规则的优先级</h2><p>优先级从高到低排列顺序为:</p><p>字符串 > 列 > 表 > 数据库 > 服务器</p><h2 id="字符集和排序规则的通用选择规则" style="position:relative"><a href="#%E5%AD%97%E7%AC%A6%E9%9B%86%E5%92%8C%E6%8E%92%E5%BA%8F%E8%A7%84%E5%88%99%E7%9A%84%E9%80%9A%E7%94%A8%E9%80%89%E6%8B%A9%E8%A7%84%E5%88%99" aria-label="字符集和排序规则的通用选择规则 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"/></svg></a>字符集和排序规则的通用选择规则</h2><ul><li>规则 1:如果指定了 <code>CHARACTER SET charset_name</code> 和 <code>COLLATE collation_name</code>,则直接使用 <code>charset_name</code> 字符集和 <code>collation_name</code> 排序规则。</li><li>规则 2:如果指定了 <code>CHARACTER SET charset_name</code> 且未指定 <code>COLLATE collation_name</code>,则使用 <code>charset_name</code> 字符集和 <code>charset_name</code> 对应的默认排序规则。</li><li>规则 3:如果 <code>CHARACTER SET charset_name</code> 和 <code>COLLATE collation_name</code> 都未指定,则使用更高优先级的字符集和排序规则。</li></ul><h2 id="字符合法性检查" style="position:relative"><a href="#%E5%AD%97%E7%AC%A6%E5%90%88%E6%B3%95%E6%80%A7%E6%A3%80%E6%9F%A5" aria-label="字符合法性检查 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"/></svg></a>字符合法性检查</h2><p>当指定的字符集为 utf8 或 utf8mb4 时,TiDB 仅支持合法的 utf8 字符。对于不合法的字符,会报错:<code>incorrect utf8 value</code>。该字符合法性检查与 MySQL 8.0 兼容,与 MySQL 5.7 及以下版本不兼容。</p><p>如果不希望报错,可以通过 <code>set @@tidb_skip_utf8_check=1;</code> 跳过字符检查。</p><div class="MuiBox-root css-1weqspv"><div class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation0 MuiAlert-root MuiAlert-standardInfo MuiAlert-standard css-152gid5" role="alert"><div class="MuiAlert-icon css-1l54tgj"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="InfoOutlinedIcon"><path d="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"/></svg></div><div class="MuiAlert-message css-1xsto0d"><div class="MuiTypography-root MuiTypography-body1 MuiTypography-gutterBottom MuiAlertTitle-root css-17ioyuk">注意</div><p>跳过字符检查可能会使 TiDB 检测不到应用写入的非法 UTF-8 字符,进一步导致执行 <code>ANALYZE</code> 时解码错误,以及引入其他未知的编码问题。如果应用不能保证写入字符串的合法性,不建议跳过该检查。</p></div></div></div><h2 id="排序规则支持" style="position:relative"><a href="#%E6%8E%92%E5%BA%8F%E8%A7%84%E5%88%99%E6%94%AF%E6%8C%81" aria-label="排序规则支持 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"/></svg></a>排序规则支持</h2><p>排序规则的语法支持和语义支持受到配置项 <a href="/zh/tidb/stable/tidb-configuration-file#new_collations_enabled_on_first_bootstrap"><code>new_collations_enabled_on_first_bootstrap</code></a> 的影响。这里语法支持和语义支持有所区别。语法支持是指 TiDB 能够解析和设置排序规则;而语义支持是指 TiDB 能够在比较字符串时正确地使用排序规则。</p><p>在 4.0 版本之前,TiDB 只提供了旧的排序规则框架,能够在语法上支持的绝大部分 MySQL 排序规则,但语义上所有的排序规则都当成二进制排序规则。</p><p>4.0 版本中,TiDB 增加了新的排序规则框架用于在语义上支持不同的排序规则,保证字符串比较时严格遵循对应的排序规则,详情请见下文。</p><h3 id="旧框架下的排序规则支持" style="position:relative"><a href="#%E6%97%A7%E6%A1%86%E6%9E%B6%E4%B8%8B%E7%9A%84%E6%8E%92%E5%BA%8F%E8%A7%84%E5%88%99%E6%94%AF%E6%8C%81" aria-label="旧框架下的排序规则支持 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"/></svg></a>旧框架下的排序规则支持</h3><p>在 4.0 版本之前,TiDB 中可以指定大部分 MySQL 中的排序规则,并把这些排序规则按照默认排序规则处理,即以编码字节序为字符定序。和 MySQL 不同的是,TiDB 不会处理字符末尾的空格,因此会造成以下的行为区别:</p><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">CREATE</span> <span class="hljs-keyword">TABLE</span> t(a <span class="hljs-type">varchar</span>(<span class="hljs-number">20</span>) charset utf8mb4 <span class="hljs-keyword">collate</span> utf8mb4_general_ci <span class="hljs-keyword">PRIMARY</span> KEY); </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">Query OK, <span class="hljs-number">0</span> <span class="hljs-keyword">rows</span> affected </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">INSERT</span> <span class="hljs-keyword">INTO</span> t <span class="hljs-keyword">VALUES</span> (<span class="hljs-string">'A'</span>); </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">Query OK, <span class="hljs-number">1</span> <span class="hljs-type">row</span> affected </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">INSERT</span> <span class="hljs-keyword">INTO</span> t <span class="hljs-keyword">VALUES</span> (<span class="hljs-string">'a'</span>); </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">Query OK, <span class="hljs-number">1</span> <span class="hljs-type">row</span> affected </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><p>以上语句,在 TiDB 会执行成功,而在 MySQL 中,由于 <code>utf8mb4_general_ci</code> 大小写不敏感,报错 <code>Duplicate entry 'a'</code>。</p><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">INSERT</span> <span class="hljs-keyword">INTO</span> t <span class="hljs-keyword">VALUES</span> (<span class="hljs-string">'a '</span>); </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">Query OK, <span class="hljs-number">1</span> <span class="hljs-type">row</span> affected </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><p>以上语句,在 TiDB 会执行成功,而在 MySQL 中,由于补齐空格比较,报错 <code>Duplicate entry 'a '</code>。</p><h3 id="新框架下的排序规则支持" style="position:relative"><a href="#%E6%96%B0%E6%A1%86%E6%9E%B6%E4%B8%8B%E7%9A%84%E6%8E%92%E5%BA%8F%E8%A7%84%E5%88%99%E6%94%AF%E6%8C%81" aria-label="新框架下的排序规则支持 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"/></svg></a>新框架下的排序规则支持</h3><p>TiDB 4.0 新增了完整的排序规则支持框架,从语义上支持了排序规则,并新增了配置开关 <code>new_collations_enabled_on_first_bootstrap</code>,在集群初次初始化时决定是否启用新排序规则框架。如需启用新排序规则框架,可将 <code>new_collations_enabled_on_first_bootstrap</code> 的值设为 <code>true</code>,详情参见 <a href="/zh/tidb/stable/tidb-configuration-file#new_collations_enabled_on_first_bootstrap"><code>new_collations_enabled_on_first_bootstrap</code></a>。要在该配置开关打开之后初始化集群,可以通过 <code>mysql</code>.<code>tidb</code> 表中的 <code>new_collation_enabled</code> 变量确认是否启用了新排序规则框架:</p><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">SELECT</span> VARIABLE_VALUE <span class="hljs-keyword">FROM</span> mysql.tidb <span class="hljs-keyword">WHERE</span> VARIABLE_NAME<span class="hljs-operator">=</span><span class="hljs-string">'new_collation_enabled'</span>; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-operator">+</span><span class="hljs-comment">----------------+</span> <span class="hljs-operator">|</span> VARIABLE_VALUE <span class="hljs-operator">|</span> <span class="hljs-operator">+</span><span class="hljs-comment">----------------+</span> <span class="hljs-operator">|</span> <span class="hljs-literal">True</span> <span class="hljs-operator">|</span> <span class="hljs-operator">+</span><span class="hljs-comment">----------------+</span> <span class="hljs-number">1</span> <span class="hljs-type">row</span> <span class="hljs-keyword">in</span> <span class="hljs-keyword">set</span> (<span class="hljs-number">0.00</span> sec) </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><p>在新的排序规则框架下,TiDB 能够支持 <code>utf8_general_ci</code>、<code>utf8mb4_general_ci</code>、<code>utf8_unicode_ci</code>、<code>utf8mb4_unicode_ci</code>、<code>gbk_chinese_ci</code> 和 <code>gbk_bin</code> 这几种排序规则,与 MySQL 兼容。</p><p>使用 <code>utf8_general_ci</code>、<code>utf8mb4_general_ci</code>、<code>utf8_unicode_ci</code> 、 <code>utf8mb4_unicode_ci</code> 和 <code>gbk_chinese_ci</code> 中任一种时,字符串之间的比较是大小写不敏感 (case-insensitive) 和口音不敏感 (accent-insensitive) 的。同时,TiDB 还修正了排序规则的 <code>PADDING</code> 行为:</p><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">CREATE</span> <span class="hljs-keyword">TABLE</span> t(a <span class="hljs-type">varchar</span>(<span class="hljs-number">20</span>) charset utf8mb4 <span class="hljs-keyword">collate</span> utf8mb4_general_ci <span class="hljs-keyword">PRIMARY</span> KEY); </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">Query OK, <span class="hljs-number">0</span> <span class="hljs-keyword">rows</span> affected (<span class="hljs-number">0.00</span> sec) </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">INSERT</span> <span class="hljs-keyword">INTO</span> t <span class="hljs-keyword">VALUES</span> (<span class="hljs-string">'A'</span>); </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">Query OK, <span class="hljs-number">1</span> <span class="hljs-type">row</span> affected (<span class="hljs-number">0.00</span> sec) </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">INSERT</span> <span class="hljs-keyword">INTO</span> t <span class="hljs-keyword">VALUES</span> (<span class="hljs-string">'a'</span>); </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">ERROR <span class="hljs-number">1062</span> (<span class="hljs-number">23000</span>): Duplicate entry <span class="hljs-string">'a'</span> <span class="hljs-keyword">for</span> key <span class="hljs-string">'t.PRIMARY'</span> </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><p>TiDB 兼容了 MySQL 的 case insensitive collation。</p><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">INSERT</span> <span class="hljs-keyword">INTO</span> t <span class="hljs-keyword">VALUES</span> (<span class="hljs-string">'a '</span>); </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia">ERROR <span class="hljs-number">1062</span> (<span class="hljs-number">23000</span>): Duplicate entry <span class="hljs-string">'a '</span> <span class="hljs-keyword">for</span> key <span class="hljs-string">'t.PRIMARY'</span> </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><p>TiDB 修正了 <code>PADDING</code> 行为,与 MySQL 兼容。</p><div class="MuiBox-root css-1weqspv"><div class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation0 MuiAlert-root MuiAlert-standardInfo MuiAlert-standard css-152gid5" role="alert"><div class="MuiAlert-icon css-1l54tgj"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="InfoOutlinedIcon"><path d="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"/></svg></div><div class="MuiAlert-message css-1xsto0d"><div class="MuiTypography-root MuiTypography-body1 MuiTypography-gutterBottom MuiAlertTitle-root css-17ioyuk">注意</div><p>TiDB 中 padding 的实现方式与 MySQL 的不同。在 MySQL 中,padding 是通过补齐空格实现的。而在 TiDB 中 padding 是通过裁剪掉末尾的空格来实现的。两种做法在绝大多数情况下是一致的,唯一的例外是字符串尾部包含小于空格 (0x20) 的字符时,例如 <code>'a' < 'a\t'</code> 在 TiDB 中的结果为 <code>1</code>,而在 MySQL 中,其等价于 <code>'a ' < 'a\t'</code>,结果为 <code>0</code>。</p></div></div></div><h2 id="表达式中排序规则的-coercibility-值" style="position:relative"><a href="#%E8%A1%A8%E8%BE%BE%E5%BC%8F%E4%B8%AD%E6%8E%92%E5%BA%8F%E8%A7%84%E5%88%99%E7%9A%84-coercibility-%E5%80%BC" aria-label="表达式中排序规则的 coercibility 值 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"/></svg></a>表达式中排序规则的 Coercibility 值</h2><p>如果一个表达式涉及多个不同排序规则的子表达式时,需要对计算时用的排序规则进行推断,规则如下:</p><ul><li>显式 <code>COLLATE</code> 子句的 coercibility 值为 <code>0</code>。</li><li>如果两个字符串的排序规则不兼容,这两个字符串 <code>concat</code> 结果的 coercibility 值为 <code>1</code>。</li><li>列或者 <code>CAST()</code>、<code>CONVERT()</code> 和 <code>BINARY()</code> 的排序规则的 coercibility 值为 <code>2</code>。</li><li>系统常量(<code>USER()</code> 或者 <code>VERSION()</code> 返回的字符串)的 coercibility 值为 <code>3</code>。</li><li>常量的 coercibility 值为 <code>4</code>。</li><li>数字或者中间变量的 coercibility 值为 <code>5</code>。</li><li><code>NULL</code> 或者由 <code>NULL</code> 派生出的表达式的 coercibility 值为 <code>6</code>。</li></ul><p>在推断排序规则时,TiDB 优先使用 coercibility 值较低的表达式的排序规则。如果 coercibility 值相同,则按以下优先级确定排序规则:</p><p>binary > utf8mb4_bin > (utf8mb4_general_ci = utf8mb4_unicode_ci) > utf8_bin > (utf8_general_ci = utf8_unicode_ci) > latin1_bin > ascii_bin</p><p>以下情况 TiDB 无法推断排序规则并报错:</p><ul><li>如果两个子表达式的排序规则不相同,而且表达式的 coercibility 值都为 <code>0</code>。</li><li>如果两个子表达式的排序规则不兼容,而且表达式的返回类型为 <code>String</code> 类。</li></ul><h2 id="collate-子句" style="position:relative"><a href="#collate-%E5%AD%90%E5%8F%A5" aria-label="collate 子句 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"/></svg></a><code>COLLATE</code> 子句</h2><p>TiDB 支持使用 <code>COLLATE</code> 子句来指定一个表达式的排序规则,该表达式的 coercibility 值为 <code>0</code>,具有最高的优先级。示例如下:</p><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-keyword">SELECT</span> <span class="hljs-string">'a'</span> <span class="hljs-operator">=</span> _utf8mb4 <span class="hljs-string">'A'</span> <span class="hljs-keyword">collate</span> utf8mb4_general_ci; </div><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-1rmx1rm" tabindex="0" type="button" aria-label="Toggle code wrap"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="WrapTextIcon"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3 3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"/></svg></button><button class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall css-fxo539" tabindex="0" type="button" aria-label="copy"><svg class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1cw4hi4" focusable="false" aria-hidden="true" viewbox="0 0 24 24" data-testid="ContentCopyIcon"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg></button></code></pre><pre><code class="hljs language-sql"><div class="MuiBox-root css-1qhimia"><span class="hljs-operator">+</span><span class="hljs-comment">-----------------------------------------------+</span>
推荐文章
活泼的针织衫
·
“井打到哪里,铁人精神就带到哪里”--党史-中国共产党新闻网
3 月前
爱运动的热带鱼
·
开播10年了,《深夜食堂》还是这么温暖_有戏_澎湃新闻-The Paper
4 月前
玩足球的手术刀
·
千亿级头部券商资管“换帅”,去年以来还有多家券商资管高层密集变动
4 月前
无邪的橡皮擦
·
[原神漫画]刻晴你在干什么啊(看评论区)长弓燧龙作品_手机游戏热门视频
5 月前
胡子拉碴的卤蛋
·
孙健-全部作品在线阅读-微信读书
1 年前