{"id":90686,"date":"2026-08-05T20:08:36","date_gmt":"2026-08-05T12:08:36","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/90686.html"},"modified":"2026-08-05T20:08:36","modified_gmt":"2026-08-05T12:08:36","slug":"mysql%e5%ae%89%e5%85%a8%e5%8a%a0%e5%9b%ba","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/90686.html","title":{"rendered":"MySQL\u5b89\u5168\u52a0\u56fa"},"content":{"rendered":"<p id=\"u7540641d\">1.\u8d26\u53f7\u914d\u7f6e<\/p>\n<p id=\"u79afa670\">\u00b7 \u5220\u9664\u4e0d\u9700\u8981\u7684\u6570\u636e\u5e93\u8d26\u53f7\u3002<\/p>\n<p id=\"u38dfbeff\">DROP USER user<\/p>\n<p id=\"u33e62fd7\">\u5e94\u6309\u7167\u7528\u6237\u5206\u914d\u5e10\u53f7&#xff0c;\u907f\u514d\u4e0d\u540c\u7528\u6237\u95f4\u5171\u4eab\u5e10\u53f7\u3002<\/p>\n<p id=\"ud062df15\">2.\u53e3\u4ee4\u5b89\u5168<\/p>\n<p id=\"u64c4c211\">\u00b7 \u4e0d\u4f7f\u7528\u9ed8\u8ba4\u5bc6\u7801\u548c\u7ffc\u5bc6\u7801\u3002<\/p>\n<p id=\"uf07ae2db\">#\u4fee\u6539\u5bc6\u7801\u547d\u4ee4<\/p>\n<p id=\"uca6b770e\">mysql&gt; UPDATE user set password&#061;PASSWORD(&#039;testlp3&#039;) WHERE user&#061;&#039;root\u2019;<\/p>\n<p id=\"u8b1ab1c5\">3.\u6743\u9650\u914d\u7f6e<\/p>\n<p id=\"u0a4e625e\">\u7981\u6b62MySQL\u4ee5\u7cfb\u7edf\u7ba1\u7406\u5458\u8d26\u53f7\u6743\u9650\u8fd0\u884c&#xff0c;\u4f7f\u7528\u975e\u7ba1\u7406\u5458\u4e13\u7528\u8d26\u53f7\u6765\u8fd0\u884cmysql\u670d\u52a1\u3002<\/p>\n<p id=\"uee3d1ef0\">Windows.\u7cfb\u7edf<\/p>\n<p id=\"u70a0e6b1\">\u76f4\u63a5\u6253\u5f00\u4efb\u52a1\u7ba1\u7406\u5668&#xff0c;\u67e5\u770b\u8fd0\u884cmysql\u8fdb\u7a0b\u7684\u64cd\u4f5c\u7cfb\u7edf\u8d26\u53f7&#xff0c;\u4e0d\u80fd\u4e3aadministrator\u8d26\u53f7<\/p>\n<p id=\"u7946466b\">Linux\u7cfb\u7edf<\/p>\n<p id=\"u4a039761\">#\u67e5\u770bmysq1\u670d\u52a1\u7684\u8fd0\u884c\u8d26\u53f7\u662f\u5426\u4e3aroot\u6216\u5176\u4ed6\u9ad8\u6743\u9650\u8d26\u53f7<\/p>\n<p id=\"ue531ec7f\">ps -ef | grep mysql<\/p>\n<p id=\"u18b8e432\">\u6570\u636e\u5e93\u8d26\u6237\u6743\u9650\u914d\u7f6e<\/p>\n<p id=\"u7d935623\">MySQL\u6570\u636e\u5e93\u4e0b\u7684user\u8868\u548cdb\u8868\u4e2d\u5b58\u653e\u7740\u53ef\u4ee5\u6388\u4e88\u6570\u636e\u5e93\u7528\u6237\u7684\u6743\u9650&#xff0c;\u786e\u4fdd\u53ea\u6709\u7ba1\u7406\u5458\u8d26\u53f7\u624d\u80fd\u8bbf\u95ee\u6240\u6709\u6570\u636e\u5e93\u3002\u53ef\u4ee5\u8bbf\u95eemysql\u6570\u636e\u5e93\u7684\u7528\u6237\u6216\u8bb8\u53ef\u4ee5\u67e5\u770b\u5bc6\u7801\u54c8\u5e0c\u503c\u3001\u4fee\u6539\u7528\u6237\u6743\u9650\u7b49\u7b49\u3002<\/p>\n<p id=\"ube5054d7\">#\u67e5\u770b\u6570\u636e\u5e93\u6388\u6743\u60c5\u51b5\u3002<\/p>\n<p id=\"ub6de53ef\">mysql&gt; use mysql;<\/p>\n<p id=\"u1a95e484\">mysql&gt; select * from user;<\/p>\n<p id=\"u8e1d9d1f\">mysql&gt; select * from db;<\/p>\n<p id=\"uc75911d7\">#\u6388\u5b50\u6307\u5b9a\u7528\u6237\u6743\u773c\u6307\u5b9a\u8868\u7684\u6743\u9650<\/p>\n<p id=\"uae0edeca\">mysql&gt; Grant select,insert,pdate,delete on tablename to \u2018username&#039;&#064;&#039;hostname&#039;;<\/p>\n<p id=\"u172dc18b\">4.\u65e5\u5fd7\u914d\u7f6e<\/p>\n<p id=\"ue8b63f40\">\u6839\u636e\u9700\u6c42\u5f00\u542f\u5bf9\u5e94\u65e5\u5fd7\u7684\u5ba1\u8ba1\u529f\u80fd\u3002<\/p>\n<p id=\"u2fdd6f85\">#\u5f00\u542f\u9519\u8bef\u65e5\u5fd7\u5ba1\u8ba1&#xff0c;\u6253\u5f00my.ini(Windows)\u6216my.cnf(Linux)&#xff0c;\u5728[mysqld]\u4e0b\u6dfb\u52a0<\/p>\n<p id=\"u173aae3c\">log-error&#061;&#034;\/var\/log\/mysqld.log&#034;<\/p>\n<p id=\"ub32fe3a2\">5.\u8bbf\u95ee\u63a7\u5236<\/p>\n<p id=\"u0a334ee2\">\u4fee\u6539MySQL\u9ed8\u8ba4\u7aef\u53e33306\u3002<\/p>\n<p id=\"ufe3d82fa\">#\u6253\u5f00my.ini\u6216\u8005my.cnf,\u5728[mysqld]\u4e0b\u4fee\u6539<\/p>\n<p id=\"uf957764d\">#\u4fee\u6539\u6210\u5408\u9002\u7aef\u53e3<\/p>\n<p id=\"u1750d3ee\">port&#061;3306<\/p>\n<p id=\"ub9c9a5d2\">\u7f51\u7edc\u8bbf\u95ee\u9650\u5236&#xff0c;\u5728\u9632\u706b\u5899\u4e2d\u505a\u9650\u5236&#xff0c;\u53ea\u5141\u8bb8\u4e0e\u6307\u5b9a\u7684IP\u5730\u5740\u4e0e3306\u7aef\u53e3(\u6216MySQL\u6570\u636e\u5e93\u7684\u6307\u5b9a\u7aef\u53e3)\u901a\u8baf\u3002<\/p>\n<p id=\"ua2ace52a\">#\u521b\u5efa\u6307\u5b9aIP\u7684\u8fdc\u7a0b\u7528\u6237<\/p>\n<p id=\"ubec020b9\">mysql&gt; GRANT ALl privileges on \u5e93\u540d.\u8868\u540d to \u2018\u7528\u6237\u540d&#039;&#064;&#039;IP\u5730\u5740\u2019 identified by \u2018\u5bc6\u7801\u2019 with grant option;<\/p>\n<p id=\"u04057159\">mysql&gt; flush privileges;<\/p>\n<p id=\"u0d813a0c\">6.\u5176\u4ed6\u914d\u7f6e.<\/p>\n<p id=\"u48575981\">\u00b7\u5b89\u88c5\u6700\u65b0\u7684\u5b89\u5168\u8865\u4e01\u65e5\u5fd7&#xff0c;\u901a\u8fc7SELECT VERSIONO\u67e5\u770b\u7248\u672c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.\u8d26\u53f7\u914d\u7f6e\u00b7 \u5220\u9664\u4e0d\u9700\u8981\u7684\u6570\u636e\u5e93\u8d26\u53f7\u3002DROP USER user\u5e94\u6309\u7167\u7528\u6237\u5206\u914d\u5e10\u53f7&#xff0c;\u907f\u514d\u4e0d\u540c\u7528\u6237\u95f4\u5171\u4eab\u5e10\u53f7\u30022.\u53e3\u4ee4\u5b89\u5168\u00b7 \u4e0d\u4f7f\u7528\u9ed8\u8ba4\u5bc6\u7801\u548c\u7ffc\u5bc6\u7801\u3002#\u4fee\u6539\u5bc6\u7801\u547d\u4ee4mysql&gt; UPDATE user set passwordPASSWORD(testlp3) WHERE userroot\u2019;3.\u6743\u9650\u914d\u7f6e\u7981\u6b62MySQL\u4ee5\u7cfb\u7edf\u7ba1\u7406\u5458\u8d26\u53f7\u6743\u9650\u8fd0\u884c&#xff0c;\u4f7f\u7528\u975e\u7ba1\u7406\u5458\u4e13\u7528\u8d26\u53f7\u6765\u8fd0\u884cmysql\u670d\u52a1\u3002Windows.\u7cfb\u7edf\u76f4\u63a5\u6253\u5f00\u4efb\u52a1\u7ba1\u7406\u5668&#xff0c;\u67e5\u770b\u8fd0\u884c<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[116],"topic":[],"class_list":["post-90686","post","type-post","status-publish","format-standard","hentry","category-server","tag-adb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>MySQL\u5b89\u5168\u52a0\u56fa - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/90686.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL\u5b89\u5168\u52a0\u56fa - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"1.\u8d26\u53f7\u914d\u7f6e\u00b7 \u5220\u9664\u4e0d\u9700\u8981\u7684\u6570\u636e\u5e93\u8d26\u53f7\u3002DROP USER user\u5e94\u6309\u7167\u7528\u6237\u5206\u914d\u5e10\u53f7&#xff0c;\u907f\u514d\u4e0d\u540c\u7528\u6237\u95f4\u5171\u4eab\u5e10\u53f7\u30022.\u53e3\u4ee4\u5b89\u5168\u00b7 \u4e0d\u4f7f\u7528\u9ed8\u8ba4\u5bc6\u7801\u548c\u7ffc\u5bc6\u7801\u3002#\u4fee\u6539\u5bc6\u7801\u547d\u4ee4mysql&gt; UPDATE user set passwordPASSWORD(testlp3) WHERE userroot\u2019;3.\u6743\u9650\u914d\u7f6e\u7981\u6b62MySQL\u4ee5\u7cfb\u7edf\u7ba1\u7406\u5458\u8d26\u53f7\u6743\u9650\u8fd0\u884c&#xff0c;\u4f7f\u7528\u975e\u7ba1\u7406\u5458\u4e13\u7528\u8d26\u53f7\u6765\u8fd0\u884cmysql\u670d\u52a1\u3002Windows.\u7cfb\u7edf\u76f4\u63a5\u6253\u5f00\u4efb\u52a1\u7ba1\u7406\u5668&#xff0c;\u67e5\u770b\u8fd0\u884c\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/90686.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-05T12:08:36+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/90686.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/90686.html\",\"name\":\"MySQL\u5b89\u5168\u52a0\u56fa - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-05T12:08:36+00:00\",\"dateModified\":\"2026-08-05T12:08:36+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/90686.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/90686.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/90686.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL\u5b89\u5168\u52a0\u56fa\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MySQL\u5b89\u5168\u52a0\u56fa - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/90686.html","og_locale":"zh_CN","og_type":"article","og_title":"MySQL\u5b89\u5168\u52a0\u56fa - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"1.\u8d26\u53f7\u914d\u7f6e\u00b7 \u5220\u9664\u4e0d\u9700\u8981\u7684\u6570\u636e\u5e93\u8d26\u53f7\u3002DROP USER user\u5e94\u6309\u7167\u7528\u6237\u5206\u914d\u5e10\u53f7&#xff0c;\u907f\u514d\u4e0d\u540c\u7528\u6237\u95f4\u5171\u4eab\u5e10\u53f7\u30022.\u53e3\u4ee4\u5b89\u5168\u00b7 \u4e0d\u4f7f\u7528\u9ed8\u8ba4\u5bc6\u7801\u548c\u7ffc\u5bc6\u7801\u3002#\u4fee\u6539\u5bc6\u7801\u547d\u4ee4mysql&gt; UPDATE user set passwordPASSWORD(testlp3) WHERE userroot\u2019;3.\u6743\u9650\u914d\u7f6e\u7981\u6b62MySQL\u4ee5\u7cfb\u7edf\u7ba1\u7406\u5458\u8d26\u53f7\u6743\u9650\u8fd0\u884c&#xff0c;\u4f7f\u7528\u975e\u7ba1\u7406\u5458\u4e13\u7528\u8d26\u53f7\u6765\u8fd0\u884cmysql\u670d\u52a1\u3002Windows.\u7cfb\u7edf\u76f4\u63a5\u6253\u5f00\u4efb\u52a1\u7ba1\u7406\u5668&#xff0c;\u67e5\u770b\u8fd0\u884c","og_url":"https:\/\/www.wsisp.com\/helps\/90686.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-05T12:08:36+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/90686.html","url":"https:\/\/www.wsisp.com\/helps\/90686.html","name":"MySQL\u5b89\u5168\u52a0\u56fa - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-05T12:08:36+00:00","dateModified":"2026-08-05T12:08:36+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/90686.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/90686.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/90686.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"MySQL\u5b89\u5168\u52a0\u56fa"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/90686","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=90686"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/90686\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=90686"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=90686"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=90686"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=90686"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}