{"id":6158,"date":"2024-11-14T09:08:47","date_gmt":"2024-11-14T01:08:47","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6158\/"},"modified":"2024-11-14T09:08:47","modified_gmt":"2024-11-14T01:08:47","slug":"mysql%e4%b8%ad%e6%96%87%e7%89%88%e5%a6%82%e4%bd%95%e8%ae%be%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6158\/","title":{"rendered":"mysql\u4e2d\u6587\u7248\u5982\u4f55\u8bbe\u7f6e"},"content":{"rendered":"<blockquote><p>\n  \u5982\u4f55\u5728 mysql \u4e2d\u8bbe\u7f6e\u4e2d\u6587\u7248\u672c\uff1f\u5b89\u88c5 mysql \u670d\u52a1\u5668\u548c mysql workbench\u3002\u4fee\u6539 mysql \u914d\u7f6e\u6587\u4ef6\uff0c\u6dfb\u52a0 character-set-server=utf8 \u548c collation-server=utf8_general_ci\u3002\u91cd\u542f mysql \u670d\u52a1\u5668\u3002\u4f7f\u7528 mysql workbench \u8fde\u63a5\u5230 mysql \u670d\u52a1\u5668\u3002\u66f4\u6539\u6570\u636e\u5e93\u3001\u8868\u548c\u5217\u7684\u5b57\u7b26\u96c6\u548c\u6392\u5e8f\u89c4\u5219\u4e3a utf8_general_ci\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/14\/2024061403243122555.jpg\" class=\"aligncenter\" title=\"mysql\u4e2d\u6587\u7248\u5982\u4f55\u8bbe\u7f6e\u63d2\u56fe\" alt=\"mysql\u4e2d\u6587\u7248\u5982\u4f55\u8bbe\u7f6e\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u8bbe\u7f6e MySQL \u4e2d\u6587\u7248<\/strong><\/p>\n<p><strong>\u6b65\u9aa4 1\uff1a\u5b89\u88c5 MySQL \u670d\u52a1\u5668<\/strong><\/p>\n<p>\u8bbf\u95ee MySQL \u5b98\u65b9\u7f51\u7ad9\uff08https:\/\/www..com\/\uff09\u5e76\u4e0b\u8f7d\u9002\u7528\u4e8e\u60a8\u64cd\u4f5c\u7cfb\u7edf\u7684 MySQL \u670d\u52a1\u5668\u5b89\u88c5\u7a0b\u5e8f\u3002<\/p>\n<p><strong>\u6b65\u9aa4 2\uff1a\u5b89\u88c5 MySQL Workbench<\/strong><\/p>\n<p>MySQL Workbench \u662f\u4e00\u4e2a\u56fe\u5f62\u7528\u6237\u754c\u9762\uff08GUI\uff09\uff0c\u53ef\u7528\u4e8e\u7ba1\u7406\u548c\u67e5\u8be2 MySQL \u6570\u636e\u5e93\u3002\u540c\u6837\uff0c\u4ece MySQL \u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u5e76\u5b89\u88c5 MySQL Workbench\u3002<\/p>\n<p><strong>\u6b65\u9aa4 3\uff1a\u8bbe\u7f6e\u8bed\u8a00\u73af\u5883<\/strong><\/p>\n<p><strong>Windows<\/strong><\/p>\n<ul>\n<li>\u521b\u5efa\u6216\u7f16\u8f91 MySQL \u914d\u7f6e\u6587\u4ef6\uff08my.ini \u6216 my.cnf\uff09\u3002<\/li>\n<li>\n<p>\u5728 [mysqld] \u90e8\u5206\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<pre>character-set-server=utf8\ncollation-server=utf8_general_ci<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<\/ul>\n<p><strong>Linux\/macOS<\/strong><\/p>\n<ul>\n<li>\u521b\u5efa\u6216\u7f16\u8f91 MySQL \u914d\u7f6e\u6587\u4ef6\uff08\/etc\/my.cnf\uff09\u3002<\/li>\n<li>\n<p>\u5728 [mysqld] \u90e8\u5206\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<pre>character-set-server=utf8\ncollation-server=utf8_general_ci<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<\/ul>\n<p><strong>\u6b65\u9aa4 4\uff1a\u91cd\u542f MySQL<\/strong><\/p>\n<p>\u91cd\u542f MySQL \u670d\u52a1\u5668\u4ee5\u4f7f\u8bed\u8a00\u8bbe\u7f6e\u751f\u6548\u3002<\/p>\n<p><strong>Windows<\/strong><\/p>\n<ul>\n<li>\u6309 Windows \u952e + R\uff0c\u7136\u540e\u952e\u5165 services.msc\u3002<\/li>\n<li>\u5728\u670d\u52a1\u5217\u8868\u4e2d\u627e\u5230 MySQL \u670d\u52a1\u3002<\/li>\n<li>\u53f3\u952e\u5355\u51fb\u5e76\u9009\u62e9\u201c\u91cd\u542f\u201d\u3002<\/li>\n<\/ul>\n<p><strong>Linux\/macOS<\/strong><\/p>\n<ul>\n<li>\n<p>\u5728\u7ec8\u7aef\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>sudo service mysql restart<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<\/ul>\n<p><strong>\u6b65\u9aa4 5\uff1a\u4f7f\u7528 MySQL Workbench<\/strong><\/p>\n<ul>\n<li>\u6253\u5f00 MySQL Workbench \u5e76\u8fde\u63a5\u5230 MySQL \u670d\u52a1\u5668\u3002<\/li>\n<li>\u5728\u201cHome\u201d\u9009\u9879\u5361\u4e2d\uff0c\u5355\u51fb\u201cCreate a New Connection\u201d\u3002<\/li>\n<li>\u5728\u201cConnection\u201d\u9009\u9879\u5361\u4e2d\uff0c\u914d\u7f6e\u8fde\u63a5\u8bbe\u7f6e\u3002\u786e\u4fdd\u5728\u201cDatabase\u201d\u5b57\u6bb5\u4e2d\u9009\u62e9\u8981\u8f6c\u6362\u7684\u6570\u636e\u5e93\u3002<\/li>\n<li>\u5355\u51fb\u201cConnect\u201d\u6309\u94ae\u3002<\/li>\n<li>\u53f3\u952e\u5355\u51fb\u6570\u636e\u5e93\u5e76\u9009\u62e9\u201cProperties\u201d\u3002<\/li>\n<li>\u5728\u201cGeneral\u201d\u9009\u9879\u5361\u4e2d\uff0c\u5c06\u201cDefault Character Set\u201d\u548c\u201cDefault Collation\u201d\u8bbe\u7f6e\u4e3a utf8_general_ci\u3002<\/li>\n<li>\u5355\u51fb\u201cApply\u201d\u548c\u201cOK\u201d\u6309\u94ae\u4fdd\u5b58\u66f4\u6539\u3002<\/li>\n<\/ul>\n<p><strong>\u6b65\u9aa4 6\uff1a\u66f4\u6539\u8868\u548c\u5217\u7684\u5b57\u7b26\u96c6\u548c\u6392\u5e8f\u89c4\u5219<\/strong><\/p>\n<ul>\n<li>\u5728 MySQL Workbench \u4e2d\uff0c\u5c55\u5f00\u8981\u8f6c\u6362\u7684\u6570\u636e\u5e93\u3002<\/li>\n<li>\u53f3\u952e\u5355\u51fb\u8868\u5e76\u9009\u62e9\u201cAlter Table\u201d\u3002<\/li>\n<li>\n<p>\u5728\u201cAlter Table\u201d\u7a97\u53e3\u4e2d\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u8bed\u53e5\uff1a<\/p>\n<pre>DEFAULT CHARACTER SET utf8\nDEFAULT COLLATE utf8_general_ci<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p>\u5bf9\u4e8e\u6bcf\u4e2a\u9700\u8981\u8f6c\u6362\u7684\u5217\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u8bed\u53e5\uff1a<\/p>\n<pre>ALTER COLUMN [\u5217\u540d] VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\u5355\u51fb\u201cExecute\u201d\u6309\u94ae\u4fdd\u5b58\u66f4\u6539\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u4e2d\u6587\u7248\u5982\u4f55\u8bbe\u7f6e\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u5728 mysql \u4e2d\u8bbe\u7f6e\u4e2d\u6587\u7248\u672c\uff1f\u5b89\u88c5 mysql \u670d\u52a1\u5668\u548c mysql workbench\u3002\u4fee\u6539 mysql \u914d\u7f6e\u6587\u4ef6\uff0c\u6dfb\u52a0 character-set-server=utf8 \u548c collation-server=utf8_general_ci\u3002\u91cd\u542f mysql \u670d\u52a1\u5668\u3002\u4f7f\u7528 mysql workbench \u8fde\u63a5\u5230 mysql \u670d\u52a1\u5668\u3002\u66f4\u6539\u6570\u636e\u5e93\u3001\u8868\u548c\u5217\u7684\u5b57\u7b26\u96c6\u548c\u6392\u5e8f\u89c4\u5219\u4e3a utf8_general_ci\u3002 \u5982\u4f55\u8bbe\u7f6e MySQL \u4e2d\u6587\u7248 \u6b65\u9aa4 1\uff1a\u5b89\u88c5 MySQL \u670d\u52a1\u5668 \u8bbf\u95ee MySQL \u5b98\u65b9\u7f51\u7ad9\uff08https:\/\/www..com\/\uff09\u5e76\u4e0b\u8f7d\u9002\u7528\u4e8e\u60a8\u64cd\u4f5c\u7cfb\u7edf\u7684 MySQL \u670d\u52a1\u5668\u5b89\u88c5\u7a0b\u5e8f\u3002 \u6b65\u9aa4 2\uff1a\u5b89\u88c5 MySQL Workbench MySQL Workbench \u662f\u4e00\u4e2a\u56fe\u5f62\u7528\u6237\u754c\u9762\uff08GUI\uff09\uff0c\u53ef\u7528\u4e8e\u7ba1\u7406\u548c\u67e5\u8be2 MySQL \u6570\u636e\u5e93\u3002\u540c\u6837\uff0c\u4ece MySQL \u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u5e76\u5b89\u88c5 MySQL Workbench\u3002 \u6b65\u9aa4 3\uff1a\u8bbe\u7f6e\u8bed\u8a00\u73af\u5883 Windows \u521b\u5efa\u6216\u7f16\u8f91 MySQL \u914d\u7f6e\u6587\u4ef6\uff08my.ini \u6216 my.cnf\uff09\u3002 \u5728 [mysqld] [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-6158","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=6158"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6158\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}