{"id":49,"date":"2021-03-13T12:13:42","date_gmt":"2021-03-13T04:13:42","guid":{"rendered":"http:\/\/daishen.ltd\/?p=49"},"modified":"2021-03-13T12:13:42","modified_gmt":"2021-03-13T04:13:42","slug":"mysql%e7%94%a8%e6%88%b7%e4%b8%8e%e6%9d%83%e9%99%90%e7%ae%a1%e7%90%86","status":"publish","type":"post","link":"https:\/\/www.daishen.ltd\/?p=49","title":{"rendered":"MySQL\u7528\u6237\u4e0e\u6743\u9650\u7ba1\u7406"},"content":{"rendered":"<p><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width initial-scale=1\"><br \/>\n<title>MySQL\u7528\u6237\u4e0e\u6743\u9650\u7ba1\u7406<\/title><\/p>\n<h4>MySQL\u7528\u6237\u4e0e\u6743\u9650\u7ba1\u7406<\/h4>\n<h5>\u4f5c\u7528<\/h5>\n<p>\u767b\u5f55MySQL<br \/>\n\u7ba1\u7406MySQL<\/p>\n<h5>\u7528\u6237\u7684\u5b9a\u4e49<\/h5>\n<p>\u7528\u6237\u540d@&#8217;\u767d\u540d\u5355&#8217;<\/p>\n<pre><code class=\"language-mysql\" lang=\"mysql\">wordpress@'%'\nwordpress@'localhost'\nwordpress@'127.0.0.1'\nwordpress@'10.0.0.%'\nwordpress@'10.0.0.5%'\nwordpress@'10.0.0.0\/255.255.254.0'\nwordpress@'10.0.%'\n<\/code><\/pre>\n<h5>\u7528\u6237\u7684\u64cd\u4f5c<\/h5>\n<p>\u521b\u5efa\u7528\u6237<\/p>\n<pre><code class=\"language-mysql\" lang=\"mysql\">create user cuoni@'10.0.0.%' identified by '123';      \u521b\u5efa\u65b0\u7528\u6237\u4ee5\u53ca\u8bbe\u7f6e\u5bc6\u7801\n\ngrant all on *.* to cuoni@'10.0.0.%' identified by '123';      \u81ea\u52a8\u521b\u5efa\u65b0\u7528\u6237\u5e76\u6388\u6743\uff0c\u4ec5\u9650MySQL8.0\u4ee5\u524d\u7248\u672c\n<\/code><\/pre>\n<p>\u67e5\u8be2\u7528\u6237<\/p>\n<pre><code class=\"language-mysql\" lang=\"mysql\">select user,host from mysql.user;                       \n<\/code><\/pre>\n<p>\u4fee\u6539\u7528\u6237\u5bc6\u7801<\/p>\n<pre><code class=\"language-mysql\" lang=\"mysql\">alter  user cuoni@'10.0.0.%' identified by '123456';\n<\/code><\/pre>\n<p>\u5220\u9664\u5bc6\u7801<\/p>\n<pre><code class=\"language-mysql\" lang=\"mysql\">drop user cuoni@'10.0.0.%'\uff1b\n<\/code><\/pre>\n<h5>\u6743\u9650\u7ba1\u7406<\/h5>\n<p>\u6743\u9650\u5217\u8868<\/p>\n<pre><code class=\"language-mysql\" lang=\"mysql\">ALL\n\nSELECT , INSERT, UPDATE, DELETE\uff0c CREATE\uff0c DROP, RELOAD, SHUTDOWN\uff0c PROCESS\uff0c FILE\uff0c REFERENCES\uff0cINDEX, ALTER,SHOW DATABASES ,SUPER\uff0cCREATE TEMPORARY TABLES ,LOCK TABLES\uff0cEXECUTE\uff0c REPLICATION SLAVE\uff0cREPLICATIONCLIENT\uff0cCREATE VIEW\uff0cSHOW VIEW\uff0cCREATE ROUTINE, ALTER ROUTINE, CREATE USER\uff0c EVENT\uff0cTRIGGER\uff0c CREATE  TABLESPACE .\n\nwith grant option                   \u7ed9\u522b\u4eba\u6388\u6743\u7684\u6743\u9650   \n<\/code><\/pre>\n<p>\u6388\u6743\u547d\u4ee4<\/p>\n<pre><code class=\"language-mysql\" lang=\"mysql\">grant all on *.* to cuoni@'10.0.0.%' identified by '123' with grant option; \n\ngrant \u6743\u9650 on \u4f5c\u7528\u76ee\u6807 to \u7528\u6237 identified by \u5bc6\u7801;  \n<\/code><\/pre>\n<p>\u6388\u6743\u793a\u4f8b<\/p>\n<pre><code class=\"language-mysql\" lang=\"mysql\">1.\u521b\u5efa\u4e00\u4e2a\u7ba1\u7406\u5458\u7528\u6237root, \u53ef\u4ee5\u901a\u8fc710\u7f51\u6bb5\uff0c\u7ba1\u7406\u6570\u636e\u5e93\n\ngrant all on *.* to root@'10.0.0.*' identified by '123' with grant option;\n\n2.\u521b\u5efa\u4e00\u4e2a\u5e94\u7528\u7528\u6237wordpress, \u53ef\u4ee5\u901a\u8fc710\u7f51\u6bb5\uff0cwordpress\u5e93\u4e0b\u7684\u6240\u6709\u8868\u8fdb\u884cSELECT , INSERT\uff0c UPDATE, DELETE.\n\ngrant SELECT,INSERT,UPDATE,DELETE on wordpress.* to wordpress@'110.0.0.*' identified by '123';\n\n<\/code><\/pre>\n<p>\u56de\u6536\u6743\u9650<\/p>\n<pre><code class=\"language-mysql\" lang=\"mysql\">show grants for wordpress@'10.0.0.%';        \u67e5\u770b\u7528\u6237\u6743\u9650\n\nrevoke delete on wordpress.* from wordpress@'10.0.0.%';  \u6536\u56de\u7528\u6237\u5220\u9664\u6743\u9650\n<\/code><\/pre>\n<p>\u5173\u4e8e\u751f\u4ea7\u4e2d\u5f00\u7528\u6237<br \/>\n(1)\u5982\u4f55\u6c9f\u901a\u5f00\u7528\u6237<br \/>\n1.\u662f\u5426\u6709\u90ae\u4ef6\u6279\u590d<br \/>\n2.\u5bf9\u54ea\u4e9b\u5e93\u548c\u8868\u505a\u64cd\u4f5c<br \/>\n3.\u505a\u4ec0\u4e48\u64cd\u4f5c<br \/>\n4.\u4ece\u4ec0\u4e48\u5730\u5740\u6765\u767b\u5f55<br \/>\n(2)\u5f00\u53d1\u4eba\u5458\u627e\u4f60\u8981root\u7528\u6237\u5bc6\u7801?<br \/>\n1.\u8d70\u6d41\u7a0b\u62d2\u7edd\u4ed6<br \/>\n2.\u5982\u679c\u662f\u91d1\u878d\u7c7b\u7684\u516c\u53f8<br \/>\n(1)\u539f\u5219\u4e0a\u662f\u4e0d\u5141\u8bb8\u4efb\u4f55\u975eDBA\u4eba\u5458\u6301\u6709\u6216\u7533\u8bf7root<br \/>\n(2)\u5982\u679c\u6709\u4eba\u79c1\u4e0b\u7d22\u8981root\u5bc6\u7801\uff0c\u53ca\u65f6\u4e3e\u62a5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL\u7528\u6237\u4e0e\u6743\u9650\u7ba1\u7406 MySQL\u7528\u6237\u4e0e\u6743\u9650\u7ba1\u7406 \u4f5c\u7528 \u767b\u5f55MySQL \u7ba1\u7406MySQL \u7528\u6237\u7684\u5b9a\u4e49 \u7528\u6237\u540d@ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-49","post","type-post","status-publish","format-standard","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/www.daishen.ltd\/index.php?rest_route=\/wp\/v2\/posts\/49","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.daishen.ltd\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.daishen.ltd\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.daishen.ltd\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.daishen.ltd\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=49"}],"version-history":[{"count":1,"href":"https:\/\/www.daishen.ltd\/index.php?rest_route=\/wp\/v2\/posts\/49\/revisions"}],"predecessor-version":[{"id":50,"href":"https:\/\/www.daishen.ltd\/index.php?rest_route=\/wp\/v2\/posts\/49\/revisions\/50"}],"wp:attachment":[{"href":"https:\/\/www.daishen.ltd\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=49"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.daishen.ltd\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=49"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.daishen.ltd\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=49"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}