{"id":316305,"date":"2024-01-19T21:34:50","date_gmt":"2024-01-19T13:34:50","guid":{"rendered":"https:\/\/www.idc.net\/help\/316305\/"},"modified":"2024-01-19T21:34:50","modified_gmt":"2024-01-19T13:34:50","slug":"%e6%89%be%e5%9b%9emysql-%e7%bc%96%e7%a0%81%e8%bd%ac%e6%8d%a2%e7%9a%84%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/316305\/","title":{"rendered":"\u627e\u56deMySQL \u7f16\u7801\u8f6c\u6362\u7684\u89e3\u51b3\u65b9\u6848"},"content":{"rendered":"<p>\u4ee5\u4e0b\u7684\u6587\u7ae0\u4e3b\u8981\u662f\u6d45\u8c08MySQL \u7f16\u7801\u8f6c\u6362\u4ee5\u53caMySQL \u7f16\u7801\u8f6c\u6362\u7684\u5b9e\u9645\u64cd\u4f5c\u6b65\u9aa4\uff0c\u6211\u5728\u4e00\u4e2a\u4fe1\u8a89\u5ea6\u5f88\u597d\u7684\u7f51\u7ad9\u627e\u5230\u4e00\u4e2a\u5173\u4e8eMySQL \u7f16\u7801\u8f6c\u6362\u7684\u8d44\u6599\uff0c\u62ff\u51fa\u6765\u4f9b\u5927\u5bb6\u5206\u4eab\uff0c\u5e0c\u671b\u4f1a\u7ed9\u4f60\u5e26\u6765\u4e00\u4e9b\u5e2e\u52a9\u5728\u6b64\u65b9\u9762\u3002<\/p>\n<p>\u73b0\u4ee3\u5e94\u7528\u7a0b\u5e8f\u5f88\u591a\u90fd\u652f\u6301\u591a\u8bed\u8a00\uff0c\u6240\u4ee5\u5982\u679c\u6570\u636e\u5e93\u91c7\u7528MySQL\u7684\u8bdd\uff0c\u4e00\u822c\u90fd\u5efa\u8bae\u4f7f\u7528utf8\u7f16\u7801\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u5b58\u50a8\u591a\u8bed\u8a00\u6570\u636e\u3002\u53e6\u5916\u4e00\u4e2a\u539f\u56e0\u662f\u76ee\u524d\u5927\u591a\u6570\u7684\u5f00\u53d1\u8bed\u8a00\u5982.NET\u3001JAVA\uff0c\u7a0b\u5e8f\u5185\u90e8\u672c\u8eab\u5c31\u662f\u4f7f\u7528unicode\u5904\u7406\u7a0b\u5e8f\uff0cMySQL\u4f7f\u7528utf8\u540e\u53ef\u4ee5\u907f\u514d\u6570\u636e\u5e93\u4e0e\u7a0b\u5e8f\u4e4b\u95f4\u7684\u7f16\u7801\u8f6c\u6362\u3002<\/p>\n<p><strong>MySQL \u7f16\u7801\u8f6c\u6362 1.\u670d\u52a1\u5668\u7f16\u7801\u8bbe\u7f6e\u3002<\/strong><\/p>\n<p>MySQL server 5\u5728windows\u4e0b\u5b89\u88c5\u65f6\u53ef\u4ee5\u9009\u62e9\u6570\u636e\u5e93\u7684\u7f16\u7801\uff0c\u4f46\u5728linux\u4e0b\u5374\u4e0d\u884c\uff0c\u9ed8\u8ba4\u7f16\u7801\u662flitan1\uff0c\u6240\u4ee5\u9700\u8981\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\uff0cwindows\u4e0b\u914d\u7f6e\u6587\u4ef6\u662f\u5b89\u88c5\u76ee\u5f55\u4e0b\u7684my.ini\uff0clinux\u4e0b\u914d\u7f6e\u6587\u4ef6\u662f\/etc\/my.cnf\uff0c\u5728[client]\u3001[MySQLd]\u5206\u522b\u52a0\u4e0adefault-character-set=utf8\uff0c\u91cd\u542f\u670d\u52a1(linux\u4e0b\u547d\u4ee4\u4e3aservice MySQL restart)\u540e\u5728MySQL&gt;\u4e0b\u8f93\u5165show\uff0c\u7ed3\u679c\u4e2dcharacter_set_xxxx\u6240\u6709\u90fd\u663e\u793a\u4e3autf8\u5c31\u8868\u793a\u914d\u7f6e\u6210\u529f\u3002<\/p>\n<p><strong>MySQL \u7f16\u7801\u8f6c\u63622.\u5e94\u7528\u7a0b\u5e8f\u7684\u914d\u7f6e\u3002<\/strong><\/p>\n<p>java\uff1ajdbc:MySQL:\/\/192.168.1.231:3306\/dbname?useUnicode=true&amp;characterEncoding=utf-8<\/p>\n<p>net\uff1aServer=127.0.0.1;Database=dbname;User Id=root;Password=123456;Charset=utf8<\/p>\n<p>\u628aip\u3001dbname\u6539\u4e3a\u7cfb\u7edf\u6307\u5b9a\u7684\u3002<\/p>\n<p><strong>MySQL \u7f16\u7801\u8f6c\u63623.\u5df2\u6709\u6570\u636e\u5e93\u7f16\u7801\u8f6c\u6362\u3002<\/strong><\/p>\n<p>\u5982\u679c\u4e4b\u524d\u6709\u4e9b\u6570\u636e\u5e93\u662f\u4f7f\u7528litan1\u7f16\u7801\uff0c\u90a3\u4e48\u4f60\u9700\u8981\u5c06\u5176\u8f6c\u6362\u4e3autf8\u540e\u624d\u80fd\u66f4\u597d\u5730\u4f7f\u7528\u3002<\/p>\n<p>a. MySQLdump --default-character-set=latin1 -uroot -p123456 dbname &gt; 1.sql<\/p>\n<p>b. \u7528editplus\u4e4b\u7c7b\u7f16\u8f91\u5de5\u5177\u6253\u5f001.sql\uff0c\u5c06latin1\u8f6c\u6362\u4e3autf8\u3002(\u5728\u6d4b\u8bd5\u4e2d\u4f7f\u7528ultraedit\u8f6c\u6362\u540e\u65e0\u6cd5\u5bfc\u5165\uff0c\u4e0d\u77e5\u9053\u539f\u56e0)\u3002<\/p>\n<p>c. MySQL -u root -p 123456 dbname &lt; 1.sql<\/p>\n<p>\u5c06\u8f6c\u6362\u540e\u7684sql\u6587\u4ef6\u5bfc\u5165\u5230\u65b0\u7684\u6570\u636e\u5e93\u4e2d\u3002<\/p>\n<p>\u3010\u7f16\u8f91\u63a8\u8350\u3011<\/p>\n<ol>\n<li>MySQL\u6570\u636e\u5e93\u7684\u57fa\u672c\u64cd\u4f5c\u6f14\u793a<\/li>\n<li>\u5c06MSSQL\u6570\u636e\u8f6c\u6362\u5230MySQL\u6570\u636e\u5e93\u7684\u5b9e\u64cd\u6f14\u793a<\/li>\n<li>\u627e\u56deMySQL root\u5bc6\u7801\u7684\u89e3\u51b3\u65b9\u6848<\/li>\n<li>MySQL \u514d\u5b89\u88c5\u7248\u7684\u914d\u7f6e\u6d41\u7a0b<\/li>\n<li>MySQL\u6570\u636e\u5e93\u670d\u52a1\u542f\u52a8\u4e0d\u4e86\u7684\u89e3\u51b3\u65b9\u6848<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u4e0b\u7684\u6587\u7ae0\u4e3b\u8981\u662f\u6d45\u8c08MySQL \u7f16\u7801\u8f6c\u6362\u4ee5\u53caMySQL \u7f16\u7801\u8f6c\u6362\u7684\u5b9e\u9645\u64cd\u4f5c\u6b65\u9aa4\uff0c\u6211\u5728\u4e00\u4e2a\u4fe1\u8a89\u5ea6\u5f88\u597d\u7684\u7f51\u7ad9\u627e\u5230\u4e00 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7038],"tags":[],"class_list":["post-316305","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/316305","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=316305"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/316305\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=316305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=316305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=316305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}