{"id":740,"date":"2025-01-04T21:57:04","date_gmt":"2025-01-04T13:57:04","guid":{"rendered":"https:\/\/www.laixuexila.com\/?p=740"},"modified":"2025-01-04T21:57:04","modified_gmt":"2025-01-04T13:57:04","slug":"%e5%9c%a8-phpstudy-%e4%b8%ad%ef%bc%8c%e6%80%8e%e6%a0%b7%e8%a7%a3%e5%86%b3-mysql-%e5%90%af%e5%8a%a8%e5%a4%b1%e8%b4%a5%e7%9a%84%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"https:\/\/www.laixuexila.com\/index.php\/2025\/01\/04\/%e5%9c%a8-phpstudy-%e4%b8%ad%ef%bc%8c%e6%80%8e%e6%a0%b7%e8%a7%a3%e5%86%b3-mysql-%e5%90%af%e5%8a%a8%e5%a4%b1%e8%b4%a5%e7%9a%84%e9%97%ae%e9%a2%98\/","title":{"rendered":"\u5728 PHPStudy \u4e2d\uff0c\u600e\u6837\u89e3\u51b3 MySQL \u542f\u52a8\u5931\u8d25\u7684\u95ee\u9898"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u5728 PHPStudy \u4e2d\uff0cMySQL \u65e0\u6cd5\u542f\u52a8\u7684\u539f\u56e0\u53ef\u80fd\u6709\u5f88\u591a\uff0c\u5e38\u89c1\u7684\u95ee\u9898\u5305\u62ec\u914d\u7f6e\u9519\u8bef\u3001\u7aef\u53e3\u51b2\u7a81\u3001\u6743\u9650\u95ee\u9898\u6216\u8005\u6570\u636e\u5e93\u6587\u4ef6\u635f\u574f\u7b49\u3002\u4f60\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u6765\u6392\u67e5\u548c\u89e3\u51b3 MySQL \u542f\u52a8\u5931\u8d25\u7684\u95ee\u9898\uff1a<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">1. <strong>\u68c0\u67e5 MySQL \u9519\u8bef\u65e5\u5fd7<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">MySQL \u542f\u52a8\u5931\u8d25\u65f6\uff0c\u9519\u8bef\u65e5\u5fd7\u901a\u5e38\u4f1a\u63d0\u4f9b\u8be6\u7ec6\u7684\u9519\u8bef\u4fe1\u606f\u3002\u4f60\u53ef\u4ee5\u67e5\u770b MySQL \u7684\u9519\u8bef\u65e5\u5fd7\u6587\u4ef6\uff0c\u67e5\u627e\u66f4\u8be6\u7ec6\u7684\u9519\u8bef\u4fe1\u606f\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u65e5\u5fd7\u6587\u4ef6\u8def\u5f84<\/strong>\uff1a\u4e00\u822c\u60c5\u51b5\u4e0b\uff0cMySQL \u7684\u9519\u8bef\u65e5\u5fd7\u4f4d\u4e8e\uff1a\n<ul class=\"wp-block-list\">\n<li>Windows\uff1a<code>C:\\phpstudy_pro\\MySQL\\bin\\mysqld.log<\/code> \u6216\u8005 <code>C:\\phpstudy_pro\\MySQL\\data\\mysql_error.log<\/code>\u3002<\/li>\n\n\n\n<li>\u6216\u8005\u67e5\u770b <code>C:\\phpstudy_pro\\Logs\\mysql_error.log<\/code>\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u67e5\u770b\u65e5\u5fd7\u4e2d\u7684\u9519\u8bef\u4fe1\u606f\uff0c\u901a\u5e38\u80fd\u5e2e\u52a9\u4f60\u627e\u51fa\u542f\u52a8\u5931\u8d25\u7684\u539f\u56e0\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">2. <strong>\u68c0\u67e5\u7aef\u53e3\u51b2\u7a81<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">MySQL \u9ed8\u8ba4\u4f7f\u7528\u7aef\u53e3 <strong>3306<\/strong>\uff0c\u5982\u679c\u8be5\u7aef\u53e3\u88ab\u5176\u4ed6\u5e94\u7528\u7a0b\u5e8f\u5360\u7528\uff0cMySQL \u5c06\u65e0\u6cd5\u542f\u52a8\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u68c0\u67e5\u662f\u5426\u6709\u7aef\u53e3\u51b2\u7a81\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6253\u5f00 <strong>\u547d\u4ee4\u63d0\u793a\u7b26<\/strong> \u6216 <strong>PowerShell<\/strong>\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<br><code>bash netstat -ano | findstr :3306<\/code><\/li>\n\n\n\n<li>\u5982\u679c\u6709\u5176\u4ed6\u8fdb\u7a0b\u5360\u7528\u4e86\u7aef\u53e3 <strong>3306<\/strong>\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u5360\u7528\u8be5\u7aef\u53e3\u7684\u8fdb\u7a0b\uff1a<br><code>bash tasklist \/fi \"pid eq [\u5360\u7528\u7aef\u53e3\u7684PID]\"<\/code><\/li>\n\n\n\n<li>\u5982\u679c\u786e\u8ba4\u662f\u5176\u4ed6\u5e94\u7528\u7a0b\u5e8f\u5360\u7528\u4e86 MySQL \u7684\u7aef\u53e3\uff0c\u53ef\u4ee5\uff1a\n<ul class=\"wp-block-list\">\n<li>\u66f4\u6539 MySQL \u7684\u7aef\u53e3\uff1a\u5728 PHPStudy \u4e2d\u4fee\u6539 MySQL \u914d\u7f6e\u6587\u4ef6\uff08<code>my.ini<\/code>\uff09\u4e2d\u7684\u7aef\u53e3\u53f7\uff0c\u6216\u8005<\/li>\n\n\n\n<li>\u5173\u95ed\u5360\u7528\u8be5\u7aef\u53e3\u7684\u7a0b\u5e8f\uff0c\u91ca\u653e\u7aef\u53e3\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">3. <strong>\u4fee\u6539 MySQL \u914d\u7f6e\u6587\u4ef6\uff08<code>my.ini<\/code>\uff09<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c MySQL \u914d\u7f6e\u6587\u4ef6\u4e2d\u6709\u9519\u8bef\uff0c\u6216\u8005\u6570\u636e\u76ee\u5f55\u65e0\u6cd5\u8bbf\u95ee\uff0cMySQL \u53ef\u80fd\u65e0\u6cd5\u542f\u52a8\u3002\u4f60\u53ef\u4ee5\u5c1d\u8bd5\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6253\u5f00 <code>my.ini<\/code> \u6587\u4ef6\uff0c\u901a\u5e38\u4f4d\u4e8e <code>C:\\phpstudy_pro\\MySQL\\my.ini<\/code> \u6216 <code>C:\\phpstudy_pro\\MySQL\\data\\my.ini<\/code>\u3002<\/li>\n\n\n\n<li>\u786e\u4fdd\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u6570\u636e\u76ee\u5f55\uff08<code>datadir<\/code>\uff09\u6b63\u786e\u8bbe\u7f6e\u3002\u4f8b\u5982\uff1a<br><code>ini<\/code><\/li>\n<\/ul>\n\n\n<p>[mysqld]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">datadir=C:\/phpstudy_pro\/MySQL\/data \u5982\u679c\u914d\u7f6e\u6587\u4ef6\u6709\u8bef\uff0c\u4fee\u6b63\u5b83\u540e\u91cd\u65b0\u542f\u52a8 MySQL\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">4. <strong>\u68c0\u67e5 MySQL \u6570\u636e\u5e93\u6587\u4ef6\u6743\u9650<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c MySQL \u7684\u6570\u636e\u6587\u4ef6\u6216\u65e5\u5fd7\u6587\u4ef6\u6743\u9650\u4e0d\u6b63\u786e\uff0c\u4e5f\u4f1a\u5bfc\u81f4\u65e0\u6cd5\u542f\u52a8\u3002\u786e\u4fdd MySQL \u6570\u636e\u76ee\u5f55\u4e2d\u7684\u6587\u4ef6\u5177\u6709\u6b63\u786e\u7684\u6743\u9650\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u53f3\u952e\u70b9\u51fb <code>C:\\phpstudy_pro\\MySQL\\data<\/code> \u6587\u4ef6\u5939\uff0c\u9009\u62e9 <strong>\u5c5e\u6027<\/strong>\uff0c\u7136\u540e\u5728 <strong>\u5b89\u5168<\/strong> \u9009\u9879\u5361\u4e2d\u68c0\u67e5\u6587\u4ef6\u6743\u9650\u3002<\/li>\n\n\n\n<li>\u786e\u4fdd MySQL \u6240\u8fd0\u884c\u7684\u7528\u6237\uff08\u901a\u5e38\u662f\u5f53\u524d\u7528\u6237\uff09\u6709\u8db3\u591f\u7684\u8bfb\u5199\u6743\u9650\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">5. <strong>\u91cd\u7f6e MySQL \u6570\u636e\u76ee\u5f55<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c MySQL \u6570\u636e\u76ee\u5f55\u635f\u574f\uff0cMySQL \u53ef\u80fd\u4f1a\u65e0\u6cd5\u542f\u52a8\u3002\u4f60\u53ef\u4ee5\u5c1d\u8bd5\u91cd\u7f6e\u6570\u636e\u76ee\u5f55\uff08<strong>\u6ce8\u610f\uff1a\u8fd9\u4f1a\u5220\u9664\u6240\u6709\u6570\u636e\u5e93\u6570\u636e<\/strong>\uff09\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5728 <code>C:\\phpstudy_pro\\MySQL\\data<\/code> \u76ee\u5f55\u4e0b\u5907\u4efd\u73b0\u6709\u7684\u6570\u636e\u5e93\u6587\u4ef6\u3002<\/li>\n\n\n\n<li>\u5220\u9664 <code>data<\/code> \u76ee\u5f55\u4e0b\u7684\u6240\u6709\u6587\u4ef6\uff0c\u6216\u8005\u5c06\u5176\u91cd\u547d\u540d\u3002<\/li>\n\n\n\n<li>\u91cd\u65b0\u542f\u52a8 PHPStudy\uff0c\u8fd9\u5c06\u91cd\u65b0\u751f\u6210\u4e00\u4e2a\u5e72\u51c0\u7684\u6570\u636e\u76ee\u5f55\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u9700\u8981\u6062\u590d\u5907\u4efd\u6570\u636e\uff0c\u5c06\u5907\u4efd\u7684\u6570\u636e\u6587\u4ef6\u590d\u5236\u56de\u65b0\u751f\u6210\u7684\u6570\u636e\u76ee\u5f55\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">6. <strong>\u68c0\u67e5 MySQL \u670d\u52a1\u662f\u5426\u5df2\u542f\u52a8<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6709\u65f6 MySQL \u4f5c\u4e3a Windows \u670d\u52a1\u8fd0\u884c\uff0c\u53ef\u80fd\u6ca1\u6709\u542f\u52a8\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u624b\u52a8\u542f\u52a8 MySQL \u670d\u52a1\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6253\u5f00 <strong>\u670d\u52a1\u7ba1\u7406\u5668<\/strong>\uff1a\n<ol class=\"wp-block-list\">\n<li>\u6309\u4e0b <code>Win + R<\/code> \u952e\uff0c\u8f93\u5165 <code>services.msc<\/code> \u7136\u540e\u56de\u8f66\u3002<\/li>\n\n\n\n<li>\u5728\u670d\u52a1\u5217\u8868\u4e2d\u627e\u5230 <code>MySQL<\/code> \u670d\u52a1\uff08\u6216\u8005 <code>mysqld<\/code> \u670d\u52a1\uff09\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u5b83\u6ca1\u6709\u542f\u52a8\uff0c\u53f3\u952e\u70b9\u51fb\u8be5\u670d\u52a1\u5e76\u9009\u62e9 <strong>\u542f\u52a8<\/strong>\u3002<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">7. <strong>\u91cd\u65b0\u5b89\u88c5 MySQL<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u4e0a\u8ff0\u6b65\u9aa4\u90fd\u65e0\u6cd5\u89e3\u51b3\u95ee\u9898\uff0c\u4f60\u53ef\u4ee5\u5c1d\u8bd5\u91cd\u65b0\u5b89\u88c5 MySQL\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6253\u5f00 PHPStudy\uff0c\u505c\u6b62 MySQL \u670d\u52a1\u3002<\/li>\n\n\n\n<li>\u5907\u4efd <code>C:\\phpstudy_pro\\MySQL\\data<\/code> \u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6570\u636e\u5e93\u6587\u4ef6\uff08\u4ee5\u9632\u6570\u636e\u4e22\u5931\uff09\u3002<\/li>\n\n\n\n<li>\u5378\u8f7d MySQL \u5e76\u91cd\u65b0\u5b89\u88c5\u3002<\/li>\n\n\n\n<li>\u5728\u91cd\u65b0\u5b89\u88c5\u540e\uff0c\u5c06\u5907\u4efd\u7684\u6570\u636e\u5e93\u6587\u4ef6\u590d\u5236\u56de\u65b0\u7684\u6570\u636e\u76ee\u5f55\u4e2d\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">8. <strong>\u68c0\u67e5\u662f\u5426\u6709\u9632\u706b\u5899\u6216\u5b89\u5168\u8f6f\u4ef6\u963b\u6b62\u542f\u52a8<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u9632\u706b\u5899\u6216\u5b89\u5168\u8f6f\u4ef6\u53ef\u80fd\u4f1a\u963b\u6b62 MySQL \u542f\u52a8\u3002\u4f60\u53ef\u4ee5\u6682\u65f6\u7981\u7528\u9632\u706b\u5899\u6216\u5b89\u5168\u8f6f\u4ef6\uff0c\u770b\u770b\u662f\u5426\u80fd\u591f\u89e3\u51b3\u95ee\u9898\u3002\u5982\u679c\u786e\u8ba4\u662f\u9632\u706b\u5899\u95ee\u9898\uff0c\u53ef\u4ee5\u914d\u7f6e\u9632\u706b\u5899\u5141\u8bb8 MySQL \u7684\u7aef\u53e3\u901a\u8fc7\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">\u901a\u8fc7\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u4f60\u5e94\u8be5\u80fd\u591f\u89e3\u51b3 PHPStudy \u4e2d MySQL \u65e0\u6cd5\u542f\u52a8\u7684\u95ee\u9898\u3002\u5982\u679c\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u53ef\u4ee5\u67e5\u770b MySQL \u9519\u8bef\u65e5\u5fd7\uff0c\u83b7\u53d6\u66f4\u591a\u7684\u9519\u8bef\u4fe1\u606f\uff0c\u4ee5\u4fbf\u8fdb\u4e00\u6b65\u6392\u67e5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 PHPStudy \u4e2d\uff0cMySQL \u65e0\u6cd5\u542f\u52a8\u7684\u539f\u56e0\u53ef\u80fd\u6709\u5f88\u591a\uff0c\u5e38\u89c1\u7684\u95ee\u9898\u5305\u62ec\u914d\u7f6e\u9519\u8bef\u3001\u7aef\u53e3\u51b2\u7a81\u3001\u6743\u9650\u95ee\u9898\u6216\u8005 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61],"tags":[],"class_list":["post-740","post","type-post","status-publish","format-standard","hentry","category-php-"],"_links":{"self":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/740","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/comments?post=740"}],"version-history":[{"count":1,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/740\/revisions"}],"predecessor-version":[{"id":741,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/740\/revisions\/741"}],"wp:attachment":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/media?parent=740"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/categories?post=740"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/tags?post=740"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}