{"id":131,"date":"2023-06-05T12:40:50","date_gmt":"2023-06-05T04:40:50","guid":{"rendered":"http:\/\/pro369.com\/sale\/?p=131"},"modified":"2019-07-29T02:05:00","modified_gmt":"2019-07-29T02:05:00","slug":"%e8%b3%87%e6%96%99%e5%ba%ab-mysql-%e7%9a%84%e4%b8%ad%e6%96%87%e4%ba%82%e7%a2%bc%e8%a7%a3%e6%b1%ba%e3%80%90%e4%bf%9d%e8%a8%bc%e6%88%90%e5%8a%9f%e3%80%91%e5%b0%88%e6%a1%88","status":"publish","type":"post","link":"https:\/\/por.tw\/sale\/%e8%b3%87%e6%96%99%e5%ba%ab-mysql-%e7%9a%84%e4%b8%ad%e6%96%87%e4%ba%82%e7%a2%bc%e8%a7%a3%e6%b1%ba%e3%80%90%e4%bf%9d%e8%a8%bc%e6%88%90%e5%8a%9f%e3%80%91%e5%b0%88%e6%a1%88\/","title":{"rendered":"\u8cc7\u6599\u5eab mysql \u7684\u4e2d\u6587\u4e82\u78bc\u89e3\u6c7a\u3010\u4fdd\u8a3c\u6210\u529f\u3011\u5c08\u6848"},"content":{"rendered":"<p><span><span style=\"font-size: small\"><strong><span style=\"color: #ff00ff\">\u8cc7\u6599\u5eab mysql \u7684\u4e2d\u6587\u4e82\u78bc\u89e3\u6c7a\u3010\u4fdd\u8a3c\u6210\u529f\u3011\u5c08\u6848<\/span><\/strong> <\/span><\/span><\/p>\n<p><span><span style=\"font-size: small\">\u5728\u67b6\u7ad9\u6280\u8853\u4e2d\u5e38\u5e38\u6709\u4f86\u4fe1\u8a62\u554f\u5404\u7a2e mysql \u4e2d\u6587\u76f8\u5bb9\u7684\u554f\u984c\u3002<\/span><\/span><\/p>\n<p><span style=\"color: #0000ff\"><strong><span style=\"font-size: small\">\u8cc7\u6599\u5eabmysql\u4e2d\u6587\u4e82\u78bc\u7684\u539f\u56e0\u4e0d\u5916\u4e4e\u4e0b\u5217\u5e7e\u9ede\uff1a<\/span><\/strong><\/span><\/p>\n<p><span><strong><span style=\"font-size: small\">\u2606\u2027mysql server\u672c\u8eab\u8a2d\u5b9a\u554f\u984c\uff0c\u4f8b\u5982\u9084\u505c\u7559\u5728 latin1<\/span><\/strong><\/span><\/p>\n<p><span><strong><span style=\"font-size: small\">\u2606\u2027mysql table \u7684\u8a9e\u7cfb\u8a2d\u5b9a\u554f\u984c(\u5305\u62ec character \u8207 collation)<\/span><\/strong><\/span><\/p>\n<p><span><strong><span style=\"font-size: small\">\u2606\u2027\u7528\u6236\u7aef\u7a0b\u5f0f(\u4f8b\u5982 php) \u7684\u9023\u7dda\u8a9e\u7cfb\u8a2d\u5b9a\u554f\u984c<\/span><\/strong><\/span><\/p>\n<p><span style=\"color: #008000\"><strong><span style=\"font-size: small\">\u8acb\u8a2d\u5b9a mysql server\/table \u7684 character\/collation\uff1a<\/span><\/strong><\/span><\/p>\n<p><span style=\"color: #008000\"><strong><span style=\"font-size: small\">\u63a5\u4e0b\u4f86\u53ea\u9700\u8981\u88dc\u5145\u5e7e\u9ede\u6ce8\u610f\u4e8b\uff1a<\/span><\/strong><\/span><\/p>\n<p><span><strong><span style=\"font-size: small\">\u25ce\u3001mysql\u4e2d\u6587\u4e82\u78bc\u5fc5\u52dd\u89e3\u6c7a\u6cd5\uff1a<\/span><\/strong><\/span><\/p>\n<p><span><span style=\"font-size: small\">1\u3001mysql \u555f\u52d5\u6642\u6703\u8b80\u53d6\u4e00\u500b\u9810\u8a2d\u7684 config \u6a94\uff0c\u4e00\u822c\u540d\u7a31\u70ba my.ini\uff0c\u800c\u5b83\u6703\u5230\u4e0b\u5217\u5169\u4f4d\u7f6e\u53bb\u5c0b\u627e\u9019\u500b\u6a94\u6848\uff1a<\/span><\/span><\/p>\n<p><span><span style=\"font-size: small\">C:windowsmy.ini \u4e5f\u5c31\u662f\u4f5c\u696d\u7cfb\u7d71\u7684\u5b89\u88dd\u76ee\u9304\uff0c\u4e5f\u6709\u53ef\u80fd\u662f C:winntmy.ini<br \/>C::my.cnf \u4e5f\u5c31\u662f C disk \u7684\u6839\u76ee\u9304<\/span><\/span><\/p>\n<p><span><span style=\"font-size: small\">\u6ce8\u610f\u4e0d\u540c\u4f4d\u7f6e\u88cf\u7684\u6a94\u6848suffix\u4e0d\u4e00\u6a23\uff0c\u9019\u9ede\u5728\u4e4b\u524d\u7684\u6587\u7ae0\u4e2d\u6c92\u6709\u7279\u5225\u5f37\u8abf\uff0c\u56e0\u6b64\u90a3\u6642\u6211\u662f\u7528\u66f4\u8907\u96dc\u7684\u65b9\u6cd5\u76f4\u63a5\u91cd\u65b0\u5c07mysql \u8a3b\u518a\u5230 service\u88cf\u9762\uff0c\u4e26\u5728\u90a3\u88cf\u6307\u5b9a my.ini\u7684\u4f4d\u7f6e\u3002<\/span><\/span><\/p>\n<p><span><span style=\"font-size: small\">2\u3001my.ini \u88cf\u7684\u5167\u5bb9\u70ba\uff1a<\/span><\/span><\/p>\n<p><span><span style=\"font-size: small\">[mysqld]<br \/>default-character-set=utf8<\/span><\/span><\/p>\n<p><span><span style=\"font-size: small\">[client]<br \/>default-character-set=utf8<br \/>init_connect=&#39;SET NAMES utf8&#39;<\/span><\/span><\/p>\n<p><span><span style=\"font-size: small\">\u5176\u4e2d mysqld \u662f\u6307\u5b9a server\u555f\u52d5\u6642\u8981\u7528\u7684\u8a9e\u7cfb\uff0c\u4f46\u5982\u679c\u9019\u88cf\u8a2d\u5b9a\u70ba utf8\u53ef\u80fd\u6703\u8b93\u8a31\u591a\u82f1\u6587\u8edf\u9ad4\u4e0d\u958b\u5fc3\uff0c\u4f8b\u5982 osCommerce\/mediaWiki\uff0c\u6240\u4ee5\u9019\u88cf\u5efa\u8b70\u8a2d\u6210 latin1\u3002<\/span><\/span><\/p>\n<p><span><span style=\"font-size: small\">\u4e0b\u9762\u7684 client \u5247\u662f\u8a2d\u5b9a\u7576 client \u9023\u7dda\u6642\u8981\u4f7f\u7528\u4ec0\u9ebc\u8a9e\u7cfb\uff0c\u4f46\u53ef\u60dc\u7684\u662f\u9019\u500b\u8a2d\u5b9a\u4e0d\u662f\u6bcf\u500bclient\u90fd\u6703\u9ce5\u5b83\uff0c\u57fa\u672c\u4e0a\u53ea\u6709 mysql \u81ea\u5df2\u5bb6\u7684\u7a0b\u5f0f\uff0c\u4f8b\u5982 mysql.exe, mysqld.exe, mysqladmin.exe \u6216\u662f MySQL Control Center\u9019\u7a2e\u7a0b\u5f0f\u6703\u53bb\u8b80\u53d6\u9019\u500b\u8a2d\u5b9a\u6a94\u7136\u5f8c\u6539\u7528 utf8 \u9023\u7dda\u3002<\/span><\/span><\/p>\n<p><span><span style=\"font-size: small\">\u5728\u6b64\u63d0\u4f9b\u7b2c\u4e8c\u884c\u6307\u4ee4\uff0c\u6bd4\u4e00\u652f\u652fphp\u7a0b\u5f0f\u53bb\u8a2d\u5b9aconnection setting\u66f4\u5feb\uff0c\u9019\u6a23\u61c9\u8a72\u4e5f\u53ef\u4ee5\u9806\u4fbf\u89e3\u6c7aphpmyadmin\u7121\u6cd5\u6b63\u78ba\u986f\u793a unicode \u4e2d\u6587\u7684\u554f\u984c(\u4e0d\u904e amfphp \u5230\u662f\u4e0d\u5403\u9019\u5957\uff0c\u4e00\u5b9a\u8981\u4e56\u4e56\u7684\u81ea\u5df2\u8a2d\u5b9a\u8a9e\u7cfb\u624d\u884c)<\/span><\/span><\/p>\n<p><span><span style=\"font-size: small\">\u4f46\u5927\u90e8\u4efd\u5c08\u6848\u5e2b\u61c9\u8a72\u90fd\u662f\u81ea\u5df2\u5beb php\/jsp \u7a0b\u5f0f\u53bb\u9023\u7dda\uff0c\u6b64\u6642\u81ea\u7136\u4e0d\u6703\u8b80\u53d6\u9019\u500b\u8a2d\u5b9a\u800c\u7e7c\u7e8c\u4f7f\u7528\u9810\u8a2d\u7684\u8a9e\u7cfb &#8211; latin1\u3002<\/span><\/span><\/p>\n<p><span><span style=\"font-size: small\">\u9019\u4e5f\u6b63\u662f\u5927\u90e8\u5206\u7db2\u53cb\u9663\u4ea1\u7684\u5730\u65b9\u3002<\/span><\/span><\/p>\n<p><span><span style=\"font-size: small\">\u53ef\u4ee5\u7528\u4e00\u500b\u7368\u7acb\u7684\u6a94\u6848\u4f86\u8655\u7406 mysql connection\u7684\u8a2d\u5b9a\uff0c\u4f8b\u5982\uff1a<\/span><\/span><\/p>\n<p><span><span style=\"font-size: small\">PLAIN TEXT<br \/>PHP:<\/span><\/span><\/p>\n<p><span><span style=\"font-size: small\">&lt;?<br \/>\/\/database connection details.<br \/>$host = &quot;localhost&quot;;<br \/>$link = mysql_connect($host, &quot;xxx&quot;, &quot;xxx&quot;);<br \/>mysql_query(&quot;SET NAMES &#39;utf8&#39;&quot;);<br \/>mysql_select_db(&quot;your_table_name_here&quot;, $link);<br \/>?&gt; <\/span><\/span><\/p>\n<p><span><span style=\"font-size: small\">\u8acb\u6ce8\u610f\u5728 mysql_connect\u5f8c\u7b2c\u4e94\u884c\u7684\u5730\u65b9\u6709\u52a0\u4e0a\u4e00\u500b &quot;set names &#39;utf8&#39; &quot;\u7684\u6307\u4ee4\uff0c\u544a\u8a34mysql \u9019\u500b connection \u4e4b\u5f8c\u7684\u9023\u7dda\u5167\u5bb9\u90fd\u8981\u4f7f\u7528utf8\uff0c\u7d93\u7531\u9019\u6a23\u8a2d\u5b9a\u5f8c\uff0c\u901a\u5e38\u5c31\u53ef\u4ee5\u89e3\u6c7a\u5927\u90e8\u4efd\u554f\u984c\u3002<\/span><\/span><\/p>\n<p><span><span style=\"font-size: small\">\u5f9e\u9019\u88cf\u4e5f\u53ef\u4ee5\u63a8\u60f3\u5f97\u77e5\uff0c\u5982\u679c\u4f60\u6709\u7528\u67d0\u7a2ecustom connection pooling\u6a5f\u5236\uff0c\u5c31\u8981\u8a18\u5f97\u5728\u6bcf\u6b21\u5efa\u7acb\u65b0\u7684connection\u5f8c\u7acb\u5373\u8a2d\u5b9a\u70ba utf8\u3002<\/span><\/span><\/p>\n<p><span><span style=\"font-size: small\">\u9019\u7d44\u8a2d\u5b9a\u7d93\u7531\u5e7e\u5929\u7684\u53cd\u8986\u6e2c\u8a66(\u4f7f\u7528\u4e2d\u6587\u7e41\u3001\u7c21\u3001\u65e5\u6587\u3001\u97d3\u6587)\u5f8c\u5df2\u7d93\u8a3c\u5be6\u5b8c\u5168\u4e0d\u6703\u6709\u4e82\u78bc\u6216\u662f\u67d0\u4e9b\u5b57\u8b8a\u6210 &quot;\u53e3&quot;\u3002<\/span><\/span><\/p>\n<p><span><span style=\"font-size: small\">\u4f8b\u5b50\uff1a\u8a66\u8005\u8f38\u5165\u9019\u5e7e\u500b\u5b57\u300c\u4e0d\u9053\u53ef\u5426\u56c9\u300d\u5982\u679c\u5b83\u5011\u80fd\u6b63\u78ba\u9032\u5165mysql\u518d\u88ab\u8b80\u51fa\u4f86\uff0c\u90a3\u5c31\u662f\u4e2d\u6587\u6c92\u554f\u984c\u4e86\uff0c\u5982\u679c\u8b80\u51fa\u4f86\u5f8c\u8b8a\u6210\u300e\u53e3\u300f\u5b57\u90a3\u5c31\u662f\u9769\u547d\u9084\u672a\u6210\u529f\u540c\u5fd7\u4ecd\u9700\u52aa\u529b&#8230;orz <\/span><\/span><\/p>\n<p><span><span style=\"font-size: small\">\u7576\u7136\u6211\u4e5f\u9806\u4fbf\u6aa2\u67e5\u4e86 flex2 &#8211; amfphp &#8211; php &#8211; mysql \u4f86\u56de\u50b3resultset \u4e5f\u4e0d\u518d\u6703\u6709\u4e2d\u6587\u4e82\u78bc\u554f\u984c\uff0c\u53ef\u4ee5\u5b89\u5fc3\u4f7f\u7528\u56c9\u3002<\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8cc7\u6599\u5eab mysql \u7684\u4e2d\u6587\u4e82\u78bc\u89e3\u6c7a\u3010\u4fdd\u8a3c\u6210\u529f\u3011\u5c08\u6848 \u5728\u67b6\u7ad9\u6280\u8853\u4e2d\u5e38\u5e38\u6709\u4f86\u4fe1\u8a62\u554f\u5404\u7a2e mysql \u4e2d\u6587\u76f8\u5bb9\u7684\u554f\u984c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":611,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[22],"tags":[53,55],"_links":{"self":[{"href":"https:\/\/por.tw\/sale\/wp-json\/wp\/v2\/posts\/131"}],"collection":[{"href":"https:\/\/por.tw\/sale\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/por.tw\/sale\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/por.tw\/sale\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/por.tw\/sale\/wp-json\/wp\/v2\/comments?post=131"}],"version-history":[{"count":0,"href":"https:\/\/por.tw\/sale\/wp-json\/wp\/v2\/posts\/131\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/por.tw\/sale\/wp-json\/wp\/v2\/media\/611"}],"wp:attachment":[{"href":"https:\/\/por.tw\/sale\/wp-json\/wp\/v2\/media?parent=131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/por.tw\/sale\/wp-json\/wp\/v2\/categories?post=131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/por.tw\/sale\/wp-json\/wp\/v2\/tags?post=131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}