{"id":319981,"date":"2024-01-20T08:21:02","date_gmt":"2024-01-20T00:21:02","guid":{"rendered":"https:\/\/www.idc.net\/help\/319981\/"},"modified":"2024-01-20T08:21:02","modified_gmt":"2024-01-20T00:21:02","slug":"%e4%bd%bf%e7%94%a8mysql%e5%91%bd%e4%bb%a4%e8%a1%8c%e6%96%b0%e5%bb%ba%e7%94%a8%e6%88%b7%e5%b9%b6%e6%8e%88%e4%ba%88%e6%9d%83%e9%99%90%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/319981\/","title":{"rendered":"\u4f7f\u7528MySQL\u547d\u4ee4\u884c\u65b0\u5efa\u7528\u6237\u5e76\u6388\u4e88\u6743\u9650\u7684\u65b9\u6cd5"},"content":{"rendered":"<p>MySQL\u547d\u4ee4\u884c\u80fd\u5426\u5b9e\u73b0\u65b0\u5efa\u7528\u6237\u5462\uff1f\u7b54\u6848\u65e0\u7591\u662f\u80af\u5b9a\u7684\u3002\u800c\u4e14\u5728\u4f7f\u7528\u4f7f\u7528MySQL\u547d\u4ee4\u884c\u65b0\u5efa\u7528\u6237\u540e\uff0c\u8fd8\u53ef\u4ee5\u4e3a\u7528\u6237\u6388\u4e88\u6743\u9650\u3002<\/p>\n<p>\u9996\u5148\u8981\u58f0\u660e\u4e00\u4e0b\uff1a\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u4fee\u6539MySQL\u5bc6\u7801\uff0c\u6388\u6743\uff0c\u662f\u9700\u8981\u6709mysql\u91cc\u7684root\u6743\u9650\u7684\u3002<br \/> \u6ce8\uff1a\u672c\u64cd\u4f5c\u662f\u5728WIN\u547d\u4ee4\u63d0\u793a\u7b26\u4e0b\uff0cphpMyAdmin\u540c\u6837\u9002\u7528\u3002<br \/> \u7528\u6237\uff1aphplamp<br \/> \u7528\u6237\u6570\u636e\u5e93\uff1aphplampDB<\/p>\n<p>1.MySQL\u547d\u4ee4\u884c\u65b0\u5efa\u7528\u6237<\/p>\n<p>\/\/\u767b\u5f55MYSQL<br \/> @&gt;mysql -u root -p<br \/> @&gt;\u5bc6\u7801<br \/> \/\/\u521b\u5efa\u7528\u6237<br \/> mysql&gt; insert into mysql.user(Host,User,Password) values('localhost','phplamp',password('1234'));<br \/> \/\/\u5237\u65b0\u7cfb\u7edf\u6743\u9650\u8868<br \/> mysql&gt;flush privileges;<br \/> \u8fd9\u6837\u5c31\u521b\u5efa\u4e86\u4e00\u4e2a\u540d\u4e3a\uff1aphplamp&nbsp; \u5bc6\u7801\u4e3a\uff1a1234&nbsp; \u7684\u7528\u6237\u3002<\/p>\n<p>\/\/\u9000\u51fa\u540e\u767b\u5f55\u4e00\u4e0b<br \/> mysql&gt;exit;<br \/> @&gt;mysql -u phplamp -p<br \/> @&gt;\u8f93\u5165\u5bc6\u7801<br \/> mysql&gt;\u767b\u5f55\u6210\u529f<\/p>\n<p>2.MySQL\u547d\u4ee4\u884c\u4e3a\u7528\u6237\u6388\u6743<\/p>\n<p>\/\/\u767b\u5f55MYSQL\uff08\u6709ROOT\u6743\u9650\uff09\u3002\u6211\u91cc\u6211\u4ee5ROOT\u8eab\u4efd\u767b\u5f55.<br \/> @&gt;mysql -u root -p<br \/> @&gt;\u5bc6\u7801<br \/> \/\/\u9996\u5148\u4e3a\u7528\u6237\u521b\u5efa\u4e00\u4e2a\u6570\u636e\u5e93(phplampDB)<br \/> mysql&gt;create database phplampDB;<br \/> \/\/\u6388\u6743phplamp\u7528\u6237\u62e5\u6709phplamp\u6570\u636e\u5e93\u7684\u6240\u6709\u6743\u9650<br \/> @&gt;grant all privileges on phplampDB.* to phplamp@localhost identified by '1234';<br \/> \/\/\u5237\u65b0\u7cfb\u7edf\u6743\u9650\u8868<br \/> mysql&gt;flush privileges;<br \/> mysql&gt;\u5176\u5b83\u64cd\u4f5c<\/p>\n<p>\/\/\u5982\u679c\u60f3\u6307\u5b9a\u90e8\u5206\u6743\u9650\u7ed9\u4e00\u7528\u6237\uff0c\u53ef\u4ee5\u8fd9\u6837\u6765\u5199:<br \/> mysql&gt;grant select,update on phplampDB.* to phplamp@localhost identified by '1234';<br \/> \/\/\u5237\u65b0\u7cfb\u7edf\u6743\u9650\u8868\u3002<br \/> mysql&gt;flush privileges;<\/p>\n<p>mysql&gt; grant \u6743\u96501,\u6743\u96502,\u2026\u6743\u9650n on \u6570\u636e\u5e93\u540d\u79f0.\u8868\u540d\u79f0 to \u7528\u6237\u540d@\u7528\u6237\u5730\u5740 identified by \u2018\u8fde\u63a5\u53e3\u4ee4\u2019;<\/p>\n<p>\u6743\u96501,\u6743\u96502,\u2026\u6743\u9650n\u4ee3\u8868select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file\u7b4914\u4e2a\u6743\u9650\u3002<br \/> \u5f53\u6743\u96501,\u6743\u96502,\u2026\u6743\u9650n\u88aball privileges\u6216\u8005all\u4ee3\u66ff\uff0c\u8868\u793a\u8d4b\u4e88\u7528\u6237\u5168\u90e8\u6743\u9650\u3002<br \/> \u5f53\u6570\u636e\u5e93\u540d\u79f0.\u8868\u540d\u79f0\u88ab*.*\u4ee3\u66ff\uff0c\u8868\u793a\u8d4b\u4e88\u7528\u6237\u64cd\u4f5c\u670d\u52a1\u5668\u4e0a\u6240\u6709\u6570\u636e\u5e93\u6240\u6709\u8868\u7684\u6743\u9650\u3002<br \/> \u7528\u6237\u5730\u5740\u53ef\u4ee5\u662flocalhost\uff0c\u4e5f\u53ef\u4ee5\u662fip\u5730\u5740\u3001\u673a\u5668\u540d\u5b57\u3001\u57df\u540d\u3002\u4e5f\u53ef\u4ee5\u7528\u2019%'\u8868\u793a\u4ece\u4efb\u4f55\u5730\u5740\u8fde\u63a5\u3002<br \/> \u2018\u8fde\u63a5\u53e3\u4ee4\u2019\u4e0d\u80fd\u4e3a\u7a7a\uff0c\u5426\u5219\u521b\u5efa\u5931\u8d25\u3002<\/p>\n<p>\u4f8b\u5982\uff1a<br \/> mysql&gt;grant select,insert,update,delete,create,drop on vtdc.employee to joe@10.163.225.87 identified by \u2018123\u2032;<br \/> \u7ed9\u6765\u81ea10.163.225.87\u7684\u7528\u6237joe\u5206\u914d\u53ef\u5bf9\u6570\u636e\u5e93vtdc\u7684employee\u8868\u8fdb\u884cselect,insert,update,delete,create,drop\u7b49\u64cd\u4f5c\u7684\u6743\u9650\uff0c\u5e76\u8bbe\u5b9a\u53e3\u4ee4\u4e3a123\u3002<\/p>\n<p>mysql&gt;grant all privileges on vtdc.* to joe@10.163.225.87 identified by \u2018123\u2032;<br \/> \u7ed9\u6765\u81ea10.163.225.87\u7684\u7528\u6237joe\u5206\u914d\u53ef\u5bf9\u6570\u636e\u5e93vtdc\u6240\u6709\u8868\u8fdb\u884c\u6240\u6709\u64cd\u4f5c\u7684\u6743\u9650\uff0c\u5e76\u8bbe\u5b9a\u53e3\u4ee4\u4e3a123\u3002<\/p>\n<p>mysql&gt;grant all privileges on *.* to joe@10.163.225.87 identified by \u2018123\u2032;<br \/> \u7ed9\u6765\u81ea10.163.225.87\u7684\u7528\u6237joe\u5206\u914d\u53ef\u5bf9\u6240\u6709\u6570\u636e\u5e93\u7684\u6240\u6709\u8868\u8fdb\u884c\u6240\u6709\u64cd\u4f5c\u7684\u6743\u9650\uff0c\u5e76\u8bbe\u5b9a\u53e3\u4ee4\u4e3a123\u3002<\/p>\n<p>mysql&gt;grant all privileges on *.* to joe@localhost identified by \u2018123\u2032;<br \/> \u7ed9\u672c\u673a\u7528\u6237joe\u5206\u914d\u53ef\u5bf9\u6240\u6709\u6570\u636e\u5e93\u7684\u6240\u6709\u8868\u8fdb\u884c\u6240\u6709\u64cd\u4f5c\u7684\u6743\u9650\uff0c\u5e76\u8bbe\u5b9a\u53e3\u4ee4\u4e3a123\u3002 <br \/> &nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u3010\u7f16\u8f91\u63a8\u8350\u3011<\/p>\n<p>MySQL\u67e5\u8be2\u4e71\u7801\u7684\u89e3\u51b3\u65b9\u6cd5<\/p>\n<p>MySQL\u5220\u9664\u91cd\u590d\u8bb0\u5f55\u7684\u65b9\u6cd5<\/p>\n<p>MySQL\u67e5\u8be2\u7f13\u5b58\u673a\u5236\u7b80\u4ecb<\/p>\n<p>5\u79cd\u5e38\u89c1\u7684MySQL\u65e5\u5fd7\u7c7b\u578b<\/p>\n<p>mysql\u65e5\u5fd7\u6587\u4ef6\u7684\u8be6\u7ec6\u8bf4\u660e<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL\u547d\u4ee4\u884c\u80fd\u5426\u5b9e\u73b0\u65b0\u5efa\u7528\u6237\u5462\uff1f\u7b54\u6848\u65e0\u7591\u662f\u80af\u5b9a\u7684\u3002\u800c\u4e14\u5728\u4f7f\u7528\u4f7f\u7528MySQL\u547d\u4ee4\u884c\u65b0\u5efa\u7528\u6237\u540e\uff0c\u8fd8\u53ef\u4ee5\u4e3a\u7528\u6237\u6388 [&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-319981","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/319981","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=319981"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/319981\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=319981"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=319981"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=319981"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}