{"id":315832,"date":"2024-01-19T03:10:26","date_gmt":"2024-01-18T19:10:26","guid":{"rendered":"https:\/\/www.idc.net\/help\/315832\/"},"modified":"2024-01-19T03:10:26","modified_gmt":"2024-01-18T19:10:26","slug":"%e8%a7%a3%e5%86%b3mysql%e4%b8%ad%e6%96%87%e4%b9%b1%e7%a0%81%e7%9a%84%e6%96%b9%e6%b3%95%e5%bd%92%e7%ba%b3","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/315832\/","title":{"rendered":"\u89e3\u51b3MySQL\u4e2d\u6587\u4e71\u7801\u7684\u65b9\u6cd5\u5f52\u7eb3"},"content":{"rendered":"<p>\u672c\u6587\u4e3b\u8981\u662f\u4ecb\u7ecd\u89e3\u51b3MySQL\u4e2d\u6587\u4e71\u7801\u7684\u65b9\u6cd5\u5f52\u7eb3\uff0c\u5982\u679c\u4f60\u5728\u89e3\u51b3MySQL\u4e2d\u6587\u4e71\u7801\u7684\u5b9e\u9645\u64cd\u4f5c\u4e2d\u5b58\u5728\u4e0d\u89e3\u4e4b\u5904\u65f6\uff0c\u4f60\u4e0d\u59a8\u6d4f\u89c8\u4e0b\u9762\u7684\u6587\u7ae0\uff0c\u5e0c\u671b\u4f60\u80fd\u4ece\u4e2d\u83b7\u5f97\u81ea\u5df1\u60f3\u8981\u7684\u4e1c\u897f\u3002\u81ea\u4ece\u5199\u5b8c\u4e0b\u9762\u4e24\u7bc7\u6587\u7ae0\uff1a<\/p>\n<p>wordpress 1.5\u5347\u7ea7\u6ce8\u610f\u4e8b\u9879MySQL \u4e2d\u6587\u4e71\u7801\u7bc7<\/p>\n<p>MySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408) 4.1\u4e2d\u6587\u4e71\u7801\u7b2c\u4e8c\u51fb<\/p>\n<p>\u8fc7\u53bb\u51e0\u4e2a\u6708\u5c31\u4e0d\u65ad\u6709\u6765\u4fe1\u8be2\u95ee\u5404\u79cdMySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408)\u4e2d\u6587\u76f8\u5bb9\u7684\u95ee\u9898\uff0c\u6240\u4ee5\u6709\u673a\u4f1a\u770b\u5230\u8bb8\u591a\u73a9\u5bb6\u4eec\u7528\u7684\u5404\u5f0f\u8fde\u63a5\u6cd5\u4e0e\u7a0b\u5f0f\uff0c\u5b9e\u5728\u592a\u5f00\u773c\u754c\u3002<\/p>\n<p>\u6700\u8fd1\u56e0\u4e3a\u8f6c\u6362\u5230flex 2\u505a\u4e3a\u5f00\u53d1\u5e73\u53f0\u5e76\u91cd\u5199\u4e00\u4e9b\u4ea7\u54c1\uff0c\u8bb8\u591a\u53bb\u5e74\u5199\u7684framework\u5c31\u65e0\u6cd5\u4f7f\u7528\uff0c\u800c\u5176\u4e2d\u6709\u90e8\u4efd\u4e13\u95e8\u5904\u7406\u591a\u56fd\u8bed\u7cfb\u7684library\u4e5f\u968f\u4e4b\u5931\u6548\uff0c\u5bfc\u81f4\u6211\u5f97\u91cd\u65b0\u9762\u5bf9\u8fd9\u4e2a\u95ee\u9898\uff0c\u6240\u4ee5\u6b63\u597d\u7c4d\u6b64\u673a\u4f1a\u5c06\u4e00\u4e9b\u65b0\u5fc3\u5f97\u6574\u7406\u51fa\u6765\u3002<\/p>\n<p>MySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408)\u4e2d\u6587\u4e71\u7801\u7684\u539f\u56e0<\/p>\n<p>&nbsp;<\/p>\n<p>MySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408)\u4f1a\u51fa\u73b0MySQL \u4e2d\u6587\u4e71\u7801\u7684\u539f\u56e0\u4e0d\u5916\u4e4e\u4e0b\u5217\u51e0\u70b9\uff1a<\/p>\n<p>MySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408) server\u672c\u8eab\u8bbe\u5b9a\u95ee\u9898\uff0c\u4f8b\u5982\u8fd8\u505c\u7559\u5728latin1<\/p>\n<p>MySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408) table\u7684\u8bed\u7cfb\u8bbe\u5b9a\u95ee\u9898(\u5305\u542bcharacter\u4e0ecollation)<\/p>\n<p>\u5ba2\u6237\u7aef\u7a0b\u5f0f(\u4f8b\u5982php)\u7684\u8fde\u7ebf\u8bed\u7cfb\u8bbe\u5b9a\u95ee\u9898<\/p>\n<p>\u5728\u4e4b\u524d\u7684\u4e24\u7bc7\u6587\u7ae0\u4e2d\u5df2\u4ecb\u7ecd\u8fc7\u5982\u4f55\u8bbe\u5b9aMySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408) server\/table\u7684character\/collation\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\u53ea\u9700\u8981\u8865\u5145\u51e0\u70b9\u6ce8\u610f\u4e8b\uff1a<\/p>\n<p>MySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408)MySQL \u4e2d\u6587\u4e71\u7801\u5fc5\u80dc\u89e3\u51b3\u6cd5<\/p>\n<p>&nbsp;<\/p>\n<p>1\u3001MySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408)\u542f\u52a8\u65f6\u4f1a\u8bfb\u53d6\u4e00\u4e2a\u9884\u8bbe\u7684config\u6863\uff0c\u4e00\u822c\u540d\u79f0\u4e3amy.ini\uff0c\u800c\u5b83\u4f1a\u5230\u4e0b\u5217\u4e24\u4f4d\u7f6e\u53bb\u5bfb\u627e\u8fd9\u4e2a\u6863\u6848\uff1a<\/p>\n<p>C:\\windows\\my.ini\u4e5f\u5c31\u662f\u4f5c\u4e1a\u7cfb\u7edf\u7684\u5b89\u88c5\u76ee\u5f55\uff0c\u4e5f\u6709\u53ef\u80fd\u662fC:\\winnt\\my.ini<\/p>\n<p>C:\\:my.cnf\u4e5f\u5c31\u662fC disk\u7684\u6839\u76ee\u5f55<\/p>\n<p>&nbsp;<\/p>\n<p>\u6ce8\u610f\u4e0d\u540c\u4f4d\u7f6e\u91cc\u7684\u6863\u6848suffix\u4e0d\u4e00\u6837\uff0c\u8fd9\u70b9\u5728\u4e4b\u524d\u7684\u6587\u7ae0\u4e2d\u6ca1\u6709\u7279\u522b\u5f3a\u8c03\uff0c\u56e0\u6b64\u90a3\u65f6\u6211\u662f\u7528\u66f4\u590d\u6742\u7684\u65b9\u6cd5\u76f4\u63a5\u91cd\u65b0\u5c06MySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408)\u6ce8\u518c\u5230service\u91cc\u9762\uff0c\u5e76\u5728\u90a3\u91cc\u6307\u5b9amy.ini\u7684\u4f4d\u7f6e\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>2\u3001my.ini\u91cc\u7684\u5185\u5bb9\u4e3a\uff1a<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<pre>\n \n \n <ol>\n  \n  \n  <li><span>[MySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408)d] &nbsp;<\/span><\/li>\n  \n  \n  <li><span>defaultcharacterset<\/span><span>=<\/span><span>utf8<\/span><span>&nbsp;<\/span><\/li>\n  \n  \n  <li><span>[client] &nbsp;<\/span><\/li>\n  \n  \n  <li><span>defaultcharacterset<\/span><span>=<\/span><span>utf8<\/span><span>&nbsp;<\/span><\/li>\n  \n  \n  <li><span>init_connect<\/span><span>=<\/span><span>'SET&nbsp;NAMES&nbsp;utf8'<\/span><span>&nbsp;<\/span><\/li>\n \n \n <\/ol><\/pre>\n<p>\u5176\u4e2dMySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408)d\u662f\u6307\u5b9aserver\u542f\u52a8\u65f6\u8981\u7528\u7684\u8bed\u7cfb\uff0c\u4f46\u5982\u679c\u8fd9\u91cc\u8bbe\u5b9a\u4e3autf8\u53ef\u80fd\u4f1a\u8ba9\u8bb8\u591a\u82f1\u6587\u8f6f\u4f53\u4e0d\u5f00\u5fc3\uff0c\u4f8b\u5982osCommerce\/mediaWiki\uff0c\u6240\u4ee5\u8fd9\u91cc\u5efa\u8bae\u8bbe\u6210latin1\u3002<\/p>\n<p>\u4e0b\u9762\u7684client\u5219\u662f\u8bbe\u5b9a\u5f53client\u8fde\u7ebf\u65f6\u8981\u4f7f\u7528\u4ec0\u4e48\u8bed\u7cfb\uff0c\u4f46\u53ef\u60dc\u7684\u662f\u8fd9\u4e2a\u8bbe\u5b9a\u4e0d\u662f\u6bcf\u4e2aclient\u90fd\u4f1a\u9e1f\u5b83\uff0c\u57fa\u672c\u4e0a\u53ea\u6709MySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408)\u81ea\u5df2\u5bb6\u7684\u7a0b\u5f0f\uff0c\u4f8b\u5982MySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408).exe, MySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408)d.exe, MySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408)admin.exe\u6216\u662fMySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408) Control Center\u8fd9\u79cd\u7a0b\u5f0f\u4f1a\u53bb\u8bfb\u53d6\u8fd9\u4e2a\u8bbe\u5b9a\u6863\u7136\u540e\u6539\u7528utf8\u8fde\u7ebf\u3002<\/p>\n<p>note:\u611f\u8c22b6s\u6851\u70ed\u60c5\u76f8\u52a9\u63d0\u4f9b\u7b2c\u4e8c\u884c\u6307\u4ee4\uff0c\u636e\u8bf4\u6bd4\u4e00\u652f\u652fphp\u7a0b\u5f0f\u53bb\u8bbe\u5b9aconnection setting\u66f4\u5feb\uff0c\u8fd9\u6837\u5e94\u8be5\u4e5f\u53ef\u4ee5\u987a\u4fbf\u89e3\u51b3phpmyadmin\u65e0\u6cd5\u6b63\u786e\u663e\u793aunicode\u4e2d\u6587\u7684\u95ee\u9898(\u4e0d\u8fc7amfphp\u5230\u662f\u4e0d\u5403\u8fd9\u5957\uff0c\u4e00\u5b9a\u8981\u4e56\u4e56\u7684\u81ea\u5df2\u8bbe\u5b9a\u8bed\u7cfb\u624d\u884c)<\/p>\n<p>&nbsp;<\/p>\n<p>\u4f46\u5927\u90e8\u4efd\u5de5\u7a0b\u5e08\u5e94\u8be5\u90fd\u662f\u81ea\u5df2\u5199php\/jsp(SUN\u4f01\u4e1a\u7ea7\u5e94\u7528\u7684***)\u7a0b\u5f0f\u53bb\u8fde\u7ebf\uff0c\u6b64\u65f6\u81ea\u7136\u4e0d\u4f1a\u8bfb\u53d6\u8fd9\u4e2a\u8bbe\u5b9a\u800c\u7ee7\u7eed\u4f7f\u7528\u9884\u8bbe\u7684\u8bed\u7cfb latin1\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u8fd9\u4e5f\u6b63\u662f\u516b\u6210\u6765\u4fe1\u670b\u53cb\u9635\u4ea1\u7684\u5730\u65b9\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u901a\u5e38\u6211\u4f1a\u7528\u4e00\u4e2a\u72ec\u7acb\u7684\u6863\u6848\u6765\u5904\u7406MySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408) connection\u7684\u8bbe\u5b9a\uff0c\u4f8b\u5982\uff1a<\/p>\n<p>&nbsp;<\/p>\n<pre>\n \n \n <ol>\n  \n  \n  <li><span><span>PLAIN&nbsp;TEXT &nbsp;<\/span><\/span><\/li>\n  \n  \n  <li><span>&lt;?<\/span><span>&nbsp;<\/span><\/li>\n  \n  \n  <li><span>\/\/database&nbsp;connection&nbsp;details. &nbsp;<\/span><\/li>\n  \n  \n  <li><span>$<\/span><span>host<\/span><span>&nbsp;=&nbsp;<\/span><span>\"localhost\"<\/span><span>; &nbsp;<\/span><\/li>\n  \n  \n  <li><span>$<\/span><span>link<\/span><span>&nbsp;=&nbsp;<\/span>MySQL<span>(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408)_connect($host,&nbsp;\"xxx\",&nbsp;\"xxx\"); &nbsp;<\/span><\/li>\n  \n  \n  <li>MySQL<span>(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408)_query(\"SET&nbsp;NAMES&nbsp;'utf8'\"); &nbsp;<\/span><\/li>\n  \n  \n  <li>MySQL<span>(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408)_select_db(\"your_table_name_here\",&nbsp;$link); &nbsp;<\/span><\/li>\n  \n  \n  <li><span>?&gt;<\/span><span>&nbsp;&nbsp;<\/span><\/li>\n \n \n <\/ol><\/pre>\n<p>\u8bf7\u6ce8\u610f\u5728MySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408)_connect\u540e\u7b2c\u4e94\u884c\u7684\u5730\u65b9\u6709\u52a0\u4e0a\u4e00\u4e2a\"set names 'utf8' \"\u7684\u6307\u4ee4\uff0c\u544a\u8bc9MySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408)\u8fd9\u4e2aconnection\u4e4b\u540e\u7684\u8fde\u7ebf\u5185\u5bb9\u90fd\u8981\u4f7f\u7528utf8\uff0c\u7ecf\u8fc7\u8fd9\u6837\u8bbe\u5b9a\u540e\uff0c\u901a\u5e38\u5c31\u53ef\u4ee5\u89e3\u51b3\u5927\u90e8\u4efd\u95ee\u9898\u3002<\/p>\n<p>\u4ece\u8fd9\u91cc\u4e5f\u53ef\u4ee5\u63a8\u60f3\u5f97\u77e5\uff0c\u5982\u679c\u4f60\u6709\u7528\u67d0\u79cdcustom connection pooling\u673a\u5236\uff0c\u5c31\u8981\u8bb0\u5f97\u5728\u6bcf\u6b21\u5efa\u7acb\u65b0\u7684connection\u540e\u7acb\u5373\u8bbe\u5b9a\u4e3autf8\u3002<\/p>\n<p>\u8fd9\u7ec4\u8bbe\u5b9a\u7ecf\u8fc7\u51e0\u5929\u7684\u53cd\u8986\u6d4b\u8bd5(\u4f7f\u7528\u4e2d\u6587\u7e41\u3001\u7b80\u3001\u65e5\u6587\u3001\u97e9\u6587)\u540e\u5df2\u7ecf\u8bc1\u5b9e\u5b8c\u5168\u4e0d\u4f1a\u6709\u4e71\u7801\u6216\u662f\u67d0\u4e9b\u5b57\u53d8\u6210\"\u53e3\"\u3002<\/p>\n<p>\u4f8b\u5b50\uff1a\u8bd5\u8005\u8f93\u5165\u8fd9\u51e0\u4e2a\u5b57\u300c\u4e0d\u9053\u53ef\u5426\u5570\u300d\u5982\u679c\u5b83\u4eec\u80fd\u6b63\u786e\u8fdb\u5165MySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408)\u518d\u88ab\u8bfb\u51fa\u6765\uff0c\u90a3\u5c31\u662f\u4e2d\u6587\u6ca1\u95ee\u9898\u4e86\uff0c\u5982\u679c\u8bfb\u51fa\u6765\u540e\u53d8\u6210\u300e\u53e3\u300f\u5b57\u90a3\u5c31\u662f\u9769\u547d\u8fd8\u672a\u6210\u529f\u540c\u5fd7\u4ecd\u9700\u52aa\u529b...orz<\/p>\n<p>\u5f53\u7136\u6211\u4e5f\u987a\u4fbf\u9a8c\u8bc1\u4e86flex2 amfphp php MySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408)\u6765\u56de\u4f20resultset\u4e5f\u4e0d\u518d\u4f1a\u6709MySQL \u4e2d\u6587\u4e71\u7801\u95ee\u9898\uff0c\u53ef\u4ee5\u5b89\u5fc3\u4f7f\u7528\u5570\u3002<\/p>\n<p>&nbsp;\u3010\u7f16\u8f91\u63a8\u8350\u3011<\/p>\n<ol>\n<li>MySQL\u542f\u52a8\u65b9\u6cd5\u4e0e\u5b9e\u9645\u64cd\u4f5c\u6b65\u9aa4<\/li>\n<li>\u5b89\u88c5\u5728MySQL4.1\u7684453h\u51fa\u73b0\u95ee\u9898\u7684\u89e3\u51b3<\/li>\n<li>MySQL5.0\u5b89\u88c5MySQL(\u548cPHP\u642d\u914d\u4e4b***\u7ec4\u5408)<\/li>\n<li>MySQL AUTO_INCREMENT\u5b9e\u9645\u64cd\u4f5c\u7528\u6cd5<\/li>\n<li>MySQL\u9ad8\u6548\u5206\u9875\u67e5\u8be2\u7684\u5b9e\u9645\u64cd\u4f5c\u6b65\u9aa4<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u4e3b\u8981\u662f\u4ecb\u7ecd\u89e3\u51b3MySQL\u4e2d\u6587\u4e71\u7801\u7684\u65b9\u6cd5\u5f52\u7eb3\uff0c\u5982\u679c\u4f60\u5728\u89e3\u51b3MySQL\u4e2d\u6587\u4e71\u7801\u7684\u5b9e\u9645\u64cd\u4f5c\u4e2d\u5b58\u5728\u4e0d\u89e3\u4e4b\u5904\u65f6\uff0c\u4f60\u4e0d [&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-315832","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/315832","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=315832"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/315832\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=315832"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=315832"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=315832"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}