{"id":63366,"date":"2025-04-29T09:38:00","date_gmt":"2025-04-29T01:38:00","guid":{"rendered":"https:\/\/fwq.ai\/blog\/63366\/"},"modified":"2025-04-29T09:38:00","modified_gmt":"2025-04-29T01:38:00","slug":"phpstudy%e5%a6%82%e4%bd%95%e9%85%8d%e7%bd%ae%e6%95%b0%e6%8d%ae%e5%ba%93-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/63366\/","title":{"rendered":"phpstudy\u5982\u4f55\u914d\u7f6e\u6570\u636e\u5e93"},"content":{"rendered":"<blockquote><p>\n  \u95ee\u9898\uff1a\u5982\u4f55\u5728 phpstudy \u4e2d\u914d\u7f6e\u6570\u636e\u5e93\uff1f\u6b65\u9aa4\uff1a\u542f\u52a8 phpstudy\u3002\u542f\u7528 mysql \u670d\u52a1\u3002\u521b\u5efa\u6570\u636e\u5e93\u3002\u521b\u5efa\u6570\u636e\u5e93\u7528\u6237\u3002\u6388\u4e88\u7528\u6237\u5bf9\u6570\u636e\u5e93\u7684\u6743\u9650\u3002\u914d\u7f6e php \u8fde\u63a5\u6570\u636e\u5e93\u3002\u6d4b\u8bd5\u8fde\u63a5\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202404\/02\/2024040215182284071.jpg\" class=\"aligncenter\" title=\"phpstudy\u5982\u4f55\u914d\u7f6e\u6570\u636e\u5e93\u63d2\u56fe\" alt=\"phpstudy\u5982\u4f55\u914d\u7f6e\u6570\u636e\u5e93\u63d2\u56fe\" \/><\/p>\n<p><strong>PHPstudy \u4e2d\u914d\u7f6e\u6570\u636e\u5e93<\/strong><\/p>\n<p>PHPstudy \u662f\u4e00\u6b3e\u96c6\u6210\u4e86 PHP\u3001MySQL\u3001Apache \u7684\u96c6\u6210\u5f00\u53d1\u73af\u5883\u3002\u5728 PHPstudy \u4e2d\u914d\u7f6e\u6570\u636e\u5e93\u975e\u5e38\u7b80\u5355\uff0c\u4e0b\u9762\u662f\u8be6\u7ec6\u6b65\u9aa4\uff1a<\/p>\n<p><strong>1. \u542f\u52a8 PHPstudy<\/strong><\/p>\n<p>\u53cc\u51fb\u684c\u9762\u56fe\u6807\u6216\u5728\u5f00\u59cb\u83dc\u5355\u4e2d\u627e\u5230\u5e76\u542f\u52a8 PHPstudy\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p><strong>2. \u542f\u7528 MySQL \u670d\u52a1<\/strong><\/p>\n<p>\u5728 PHPstudy \u754c\u9762\u4e2d\uff0c\u70b9\u51fb &#8220;MySQL&#8221; \u9009\u9879\u5361\uff0c\u7136\u540e\u786e\u4fdd &#8220;MySQL Service&#8221; \u5df2\u542f\u7528\u3002<\/p>\n<p><strong>3. \u521b\u5efa\u6570\u636e\u5e93<\/strong><\/p>\n<p>\u70b9\u51fb &#8220;Databases&#8221; \u9009\u9879\u5361\uff0c\u7136\u540e\u70b9\u51fb &#8220;Add Database&#8221; \u6309\u94ae\u3002\u5728 &#8220;\u6570\u636e\u5e93\u540d&#8221; \u5b57\u6bb5\u4e2d\u8f93\u5165\u65b0\u6570\u636e\u5e93\u7684\u540d\u79f0\uff0c\u7136\u540e\u70b9\u51fb &#8220;\u786e\u5b9a&#8221;\u3002<\/p>\n<p><strong>4. \u521b\u5efa\u6570\u636e\u5e93\u7528\u6237<\/strong><\/p>\n<p>\u70b9\u51fb &#8220;Users&#8221; \u9009\u9879\u5361\uff0c\u7136\u540e\u70b9\u51fb &#8220;Add User&#8221; \u6309\u94ae\u3002\u5728 &#8220;\u7528\u6237\u540d&#8221; \u548c &#8220;\u5bc6\u7801&#8221; \u5b57\u6bb5\u4e2d\u8f93\u5165\u65b0\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\u3002\u786e\u4fdd\u9009\u4e2d &#8220;\u6388\u4e88\u5168\u90e8\u6743\u9650&#8221; \u590d\u9009\u6846\uff0c\u7136\u540e\u70b9\u51fb &#8220;\u786e\u5b9a&#8221;\u3002<\/p>\n<p><strong>5. \u6388\u4e88\u7528\u6237\u5bf9\u6570\u636e\u5e93\u7684\u6743\u9650<\/strong><\/p>\n<p>\u56de\u5230 &#8220;Databases&#8221; \u9009\u9879\u5361\uff0c\u9009\u4e2d\u60a8\u521b\u5efa\u7684\u65b0\u6570\u636e\u5e93\u3002\u7136\u540e\uff0c\u5728 &#8220;Users&#8221; \u9009\u9879\u5361\u4e2d\uff0c\u52fe\u9009 &#8220;\u5e10\u53f7&#8221; \u5217\u4e2d\u65b0\u7528\u6237\u7684\u590d\u9009\u6846\uff0c\u5e76\u786e\u4fdd &#8220;\u6388\u4e88\u6743\u9650&#8221; \u5217\u4e2d\u663e\u793a &#8220;\u5168\u90e8\u6743\u9650&#8221;\u3002<\/p>\n<p><strong>6. \u914d\u7f6e PHP \u8fde\u63a5\u6570\u636e\u5e93<\/strong><\/p>\n<p>\u5728 PHPstudy \u7684\u6839\u76ee\u5f55\u4e0b\u627e\u5230 php.ini \u6587\u4ef6\u5e76\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\u5b83\u3002\u627e\u5230\u4ee5\u4e0b\u884c\uff1a<\/p>\n<pre>; MySQL \u914d\u7f6e\u9009\u9879\n; mysql.default_socket =\nmysql.default_host = 127.0.0.1\nmysql.default_user = root\nmysql.default_password =\nmysql.default_port = 3306<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5c06\u4ee5\u4e0b\u5185\u5bb9\u66ff\u6362\u4e3a\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre>mysql.default_socket =\nmysql.default_host = 127.0.0.1\nmysql.default_user = \u65b0\u7684\u7528\u6237\u540d\nmysql.default_password = \u65b0\u7684\u5bc6\u7801\nmysql.default_port = 3306<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4fdd\u5b58\u5e76\u5173\u95ed php.ini \u6587\u4ef6\u3002<\/p>\n<p><strong>7. \u6d4b\u8bd5\u8fde\u63a5<\/strong><\/p>\n<p>\u5728\u60a8\u7684 PHP \u4ee3\u7801\u4e2d\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u6d4b\u8bd5\u4e0e\u6570\u636e\u5e93\u7684\u8fde\u63a5\uff1a<\/p>\n<pre>&lt;?php\n$servername = \"127.0.0.1\";\n$username = \u65b0\u7684\u7528\u6237\u540d;\n$password = \u65b0\u7684\u5bc6\u7801;\n$dbname = \u65b0\u7684\u6570\u636e\u5e93\u540d;\n\n\/\/ \u521b\u5efa\u8fde\u63a5\n$conn = new mysqli($servername, $username, $password, $dbname);\n\n\/\/ \u68c0\u67e5\u8fde\u63a5\nif ($conn-&gt;connect_error) {\n  die(\"\u8fde\u63a5\u5931\u8d25: \" . $conn-&gt;connect_error);\n}\necho \"\u8fde\u63a5\u6210\u529f\";\n?&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5982\u679c\u4e00\u5207\u987a\u5229\uff0c\u60a8\u5e94\u8be5\u4f1a\u770b\u5230 &#8220;\u8fde\u63a5\u6210\u529f&#8221; \u6d88\u606f\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u914d\u7f6e\u6570\u636e\u5e93\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8FDCServers\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u95ee\u9898\uff1a\u5982\u4f55\u5728 phpstudy \u4e2d\u914d\u7f6e\u6570\u636e\u5e93\uff1f\u6b65\u9aa4\uff1a\u542f\u52a8 phpstudy\u3002\u542f\u7528 mysql \u670d\u52a1\u3002\u521b\u5efa\u6570\u636e\u5e93\u3002\u521b\u5efa\u6570\u636e\u5e93\u7528\u6237\u3002\u6388\u4e88\u7528\u6237\u5bf9\u6570\u636e\u5e93\u7684\u6743\u9650\u3002\u914d\u7f6e php \u8fde\u63a5\u6570\u636e\u5e93\u3002\u6d4b\u8bd5\u8fde\u63a5\u3002 PHPstudy \u4e2d\u914d\u7f6e\u6570\u636e\u5e93 PHPstudy \u662f\u4e00\u6b3e\u96c6\u6210\u4e86 PHP\u3001MySQL\u3001Apache \u7684\u96c6\u6210\u5f00\u53d1\u73af\u5883\u3002\u5728 PHPstudy \u4e2d\u914d\u7f6e\u6570\u636e\u5e93\u975e\u5e38\u7b80\u5355\uff0c\u4e0b\u9762\u662f\u8be6\u7ec6\u6b65\u9aa4\uff1a 1. \u542f\u52a8 PHPstudy \u53cc\u51fb\u684c\u9762\u56fe\u6807\u6216\u5728\u5f00\u59cb\u83dc\u5355\u4e2d\u627e\u5230\u5e76\u542f\u52a8 PHPstudy\u3002 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b 2. \u542f\u7528 MySQL \u670d\u52a1 \u5728 PHPstudy \u754c\u9762\u4e2d\uff0c\u70b9\u51fb &#8220;MySQL&#8221; \u9009\u9879\u5361\uff0c\u7136\u540e\u786e\u4fdd &#8220;MySQL Service&#8221; \u5df2\u542f\u7528\u3002 3. \u521b\u5efa\u6570\u636e\u5e93 \u70b9\u51fb &#8220;Databases&#8221; \u9009\u9879\u5361\uff0c\u7136\u540e\u70b9\u51fb &#8220;Add Database&#8221; \u6309\u94ae\u3002\u5728 &#8220;\u6570\u636e\u5e93\u540d&#8221; \u5b57\u6bb5\u4e2d\u8f93\u5165\u65b0\u6570\u636e\u5e93\u7684\u540d\u79f0\uff0c\u7136\u540e\u70b9\u51fb &#8220;\u786e\u5b9a&#8221;\u3002 4. \u521b\u5efa\u6570\u636e\u5e93\u7528\u6237 \u70b9\u51fb &#8220;Users&#8221; \u9009\u9879\u5361\uff0c\u7136\u540e\u70b9\u51fb &#8220;Add User&#8221; \u6309\u94ae\u3002\u5728 &#8220;\u7528\u6237\u540d&#8221; \u548c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-63366","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63366","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=63366"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63366\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=63366"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=63366"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=63366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}