{"id":6694,"date":"2024-11-14T11:54:10","date_gmt":"2024-11-14T03:54:10","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6694\/"},"modified":"2024-11-14T11:54:10","modified_gmt":"2024-11-14T03:54:10","slug":"%e5%9c%a8-linux-%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%e4%bd%bf%e7%94%a8%e8%85%be%e8%ae%af%e4%ba%91-mysql-%e6%95%b0%e6%8d%ae%e5%ba%93%e9%9c%80%e8%a6%81%e9%a2%9d%e5%a4%96%e7%9a%84%e9%85%8d%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6694\/","title":{"rendered":"\u5728 Linux \u670d\u52a1\u5668\u4e0a\u4f7f\u7528\u817e\u8baf\u4e91 MySQL \u6570\u636e\u5e93\u9700\u8981\u989d\u5916\u7684\u914d\u7f6e\u5417\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/172969293184245.jpg\" class=\"aligncenter\" title=\"\u5728 Linux \u670d\u52a1\u5668\u4e0a\u4f7f\u7528\u817e\u8baf\u4e91 MySQL \u6570\u636e\u5e93\u9700\u8981\u989d\u5916\u7684\u914d\u7f6e\u5417\uff1f\u63d2\u56fe\" alt=\"\u5728 Linux \u670d\u52a1\u5668\u4e0a\u4f7f\u7528\u817e\u8baf\u4e91 MySQL \u6570\u636e\u5e93\u9700\u8981\u989d\u5916\u7684\u914d\u7f6e\u5417\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u6570\u636e\u5e93\u914d\u7f6e\u5728\u670d\u52a1\u5668\u4e0a<\/strong><\/p>\n<p><strong>\u95ee\u9898\uff1a<\/strong><\/p>\n<p>\u5728linux\u670d\u52a1\u5668\u4e0a\u4f7f\u7528\u817e\u8baf\u4e91mysql\u6570\u636e\u5e93\uff0c\u662f\u5426\u9700\u8981\u989d\u5916\u914d\u7f6e\uff1f<\/p>\n<p><strong>\u56de\u7b54\uff1a<\/strong><\/p>\n<p>\u662f\u7684\uff0c\u5728\u5b89\u88c5\u548cphp\u540e\uff0c\u9700\u8981\u5728php\u4e2d\u914d\u7f6emysql\u6570\u636e\u5e93\u53c2\u6570\u3002\u8fd8\u9700\u8981\u6d4b\u8bd5linux\u548cmysql\u670d\u52a1\u5668\u662f\u5426\u53ef\u4ee5\u8fde\u63a5\u3002<\/p>\n<p><strong>\u8be6\u7ec6\u6b65\u9aa4\uff1a<\/strong><\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5apache\u548cphp<\/strong><\/p>\n<blockquote><p>\n    \u786e\u8ba4\u5df2\u5728linux\u670d\u52a1\u5668\u4e0a\u5b89\u88c5apache\u548cphp\u3002\n  <\/p><\/blockquote>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6ephp\u6570\u636e\u5e93\u53c2\u6570<\/strong><\/p>\n<blockquote><p>\n    \u5728php\u914d\u7f6e\u6587\u4ef6\uff08\u901a\u5e38\u4e3aphp.ini\uff09\u4e2d\u914d\u7f6e\u4ee5\u4e0b\u53c2\u6570\uff1a\n  <\/p><\/blockquote>\n<\/li>\n<\/ol>\n<pre>host=\u6570\u636e\u5e93\u4e3b\u673a\u5730\u5740\nuser=\u6570\u636e\u5e93\u7528\u6237\u540d\npassword=\u6570\u636e\u5e93\u5bc6\u7801\ndbname=\u6570\u636e\u5e93\u540d\u79f0<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ol>\n<li>\n<p><strong>\u6d4b\u8bd5\u8fde\u63a5<\/strong><\/p>\n<blockquote><p>\n    \u5728php\u9875\u9762\u4e2d\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u6d4b\u8bd5\u4e0e\u6570\u636e\u5e93\u7684\u8fde\u63a5\uff1a\n  <\/p><\/blockquote>\n<\/li>\n<\/ol>\n<pre>&lt;?php\n$conn = mysqli_connect($host, $user, $password, $dbname);\nif (!$conn) {\n    echo \"\u672a\u80fd\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff01\";\n} else {\n    echo \"\u5df2\u6210\u529f\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff01\";\n}\n?&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5982\u679c\u770b\u5230\u201c\u5df2\u6210\u529f\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff01\u201d\u7684\u6d88\u606f\uff0c\u5219\u8868\u793a\u914d\u7f6e\u6210\u529f\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5728 Linux \u670d\u52a1\u5668\u4e0a\u4f7f\u7528 MySQL \u6570\u636e\u5e93\u9700\u8981\u989d\u5916\u7684\u914d\u7f6e\u5417\uff1f\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>\u6570\u636e\u5e93\u914d\u7f6e\u5728\u670d\u52a1\u5668\u4e0a \u95ee\u9898\uff1a \u5728linux\u670d\u52a1\u5668\u4e0a\u4f7f\u7528\u817e\u8baf\u4e91mysql\u6570\u636e\u5e93\uff0c\u662f\u5426\u9700\u8981\u989d\u5916\u914d\u7f6e\uff1f \u56de\u7b54\uff1a \u662f\u7684\uff0c\u5728\u5b89\u88c5\u548cphp\u540e\uff0c\u9700\u8981\u5728php\u4e2d\u914d\u7f6emysql\u6570\u636e\u5e93\u53c2\u6570\u3002\u8fd8\u9700\u8981\u6d4b\u8bd5linux\u548cmysql\u670d\u52a1\u5668\u662f\u5426\u53ef\u4ee5\u8fde\u63a5\u3002 \u8be6\u7ec6\u6b65\u9aa4\uff1a \u5b89\u88c5apache\u548cphp \u786e\u8ba4\u5df2\u5728linux\u670d\u52a1\u5668\u4e0a\u5b89\u88c5apache\u548cphp\u3002 \u914d\u7f6ephp\u6570\u636e\u5e93\u53c2\u6570 \u5728php\u914d\u7f6e\u6587\u4ef6\uff08\u901a\u5e38\u4e3aphp.ini\uff09\u4e2d\u914d\u7f6e\u4ee5\u4e0b\u53c2\u6570\uff1a host=\u6570\u636e\u5e93\u4e3b\u673a\u5730\u5740 user=\u6570\u636e\u5e93\u7528\u6237\u540d password=\u6570\u636e\u5e93\u5bc6\u7801 dbname=\u6570\u636e\u5e93\u540d\u79f0 \u767b\u5f55\u540e\u590d\u5236 \u6d4b\u8bd5\u8fde\u63a5 \u5728php\u9875\u9762\u4e2d\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u6d4b\u8bd5\u4e0e\u6570\u636e\u5e93\u7684\u8fde\u63a5\uff1a &lt;?php $conn = mysqli_connect($host, $user, $password, $dbname); if (!$conn) { echo &#8220;\u672a\u80fd\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff01&#8221;; } else { echo &#8220;\u5df2\u6210\u529f\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff01&#8221;; } ?&gt; \u767b\u5f55\u540e\u590d\u5236 \u5982\u679c\u770b\u5230\u201c\u5df2\u6210\u529f\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff01\u201d\u7684\u6d88\u606f\uff0c\u5219\u8868\u793a\u914d\u7f6e\u6210\u529f\u3002 \u4ee5\u4e0a\u5c31\u662f\u5728 Linux \u670d\u52a1\u5668\u4e0a\u4f7f\u7528 MySQL \u6570\u636e\u5e93\u9700\u8981\u989d\u5916\u7684\u914d\u7f6e\u5417\uff1f\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},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-6694","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6694","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=6694"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6694\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6694"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6694"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6694"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}