{"id":646,"date":"2013-09-18T01:12:24","date_gmt":"2013-09-17T09:12:24","guid":{"rendered":"http:\/\/www.yclimw.com\/?p=646"},"modified":"2021-05-31T14:08:16","modified_gmt":"2021-05-31T06:08:16","slug":"c1c5061647f4ce53853f518500fb0de1","status":"publish","type":"post","link":"https:\/\/www.yclimw.com\/?p=646","title":{"rendered":"MySql\u5b9e\u73b0\u8fdc\u7a0b\u8fde\u63a5"},"content":{"rendered":"<div id=\"cnblogs_post_body\">\n<p><span style=\"color: #0080c0;\"> <span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">1\u3001\u8fdb\u5165mysql\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7528\u6237root,\u5bc6\u7801\u4e3aroot<\/span><\/span><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">\uff1a <\/span><\/p>\n<p><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">&nbsp;&nbsp; \u683c\u5f0f\uff1agrant \u6743\u9650 on \u6570\u636e\u5e93\u540d.\u8868\u540d to \u7528\u6237@\u767b\u5f55\u4e3b\u673a identified by &#8220;\u7528\u6237\u5bc6\u7801&#8221;;<\/span><\/p>\n<p><font size=\"3\"><span style=\"line-height: 24px;\"><br \/><\/span><\/font><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">&nbsp; &nbsp; &nbsp; &nbsp;<\/span><span style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\">&nbsp;&nbsp;&nbsp; <\/span><font color=\"#0000FF\" style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\"><b>grant<\/b><\/font><span style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\"> <\/span><font color=\"#0000FF\" style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\"><b>select<\/b><\/font><span style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\">,<\/span><font color=\"#0000FF\" style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\"><b>update<\/b><\/font><span style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\">,<\/span><font color=\"#0000FF\" style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\"><b>insert<\/b><\/font><span style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\">,<\/span><font color=\"#0000FF\" style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\"><b>delete<\/b><\/font><span style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\"> <\/span><font color=\"#0000FF\" style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\"><b>on<\/b><\/font><span style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\"> <\/span><font color=\"#333399\" style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\">*<\/font><span style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\">.<\/span><font color=\"#333399\" style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\">*<\/font><span style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\"> <\/span><font color=\"#0000FF\" style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\"><b>to<\/b><\/font><span style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\"> root@<\/span><font color=\"#6E00AA\" style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\">192<\/font><span style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\">.<\/span><font color=\"#6E00AA\" style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\">168<\/font><span style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\">.<\/span><font color=\"#6E00AA\" style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\">1<\/font><span style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\">.<\/span><font color=\"#6E00AA\" style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\">12<\/font><span style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\"> identified <\/span><font color=\"#0000FF\" style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\"><b>by<\/b><\/font><span style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\"> <\/span><font color=\"#FF00BF\" style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\">&#8220;root&#8221;<\/font><span style=\"font-family: 'Courier New'; font-size: 12px; line-height: 1.5;\">;<\/span><\/p>\n<p><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\"><br \/><\/span><\/p>\n<p><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">&nbsp;&nbsp; <\/span><span style=\"color: rgb(0, 128, 192); font-size: 12pt;\">\u539f\u5148\u6570\u636e\u8868\u7ed3\u6784<\/span><\/p>\n<blockquote>\n<p><code><\/p>\n<div style=\"border: 1px solid black; margin-left: auto; margin-right: auto; padding: 3px; font-family: 'Courier New'; font-size: 12px;\">\n<div>mysql<font color=\"#333399\">&gt;<\/font> use mysql;<\/div>\n<\/div>\n<p><\/code><span style=\"color: #0080c0;\"><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">Database changed<\/span><br \/><\/span><code><\/p>\n<div style=\"border: 1px solid black; margin-left: auto; margin-right: auto; padding: 3px; font-family: 'Courier New'; font-size: 12px;\">\n<div>mysql<font color=\"#333399\">&gt;<\/font> <font color=\"#0000FF\"><b>select<\/b><\/font> <font color=\"#0000FF\"><b>host<\/b><\/font>,<font color=\"#0000FF\"><b>user<\/b><\/font>,<font color=\"#0000FF\"><b>password<\/b><\/font> <font color=\"#0000FF\"><b>from<\/b><\/font> <font color=\"#0000FF\"><b>user<\/b><\/font>;<\/div>\n<\/div>\n<p><\/code><span style=\"color: #0080c0;\"><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">| host&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | user | password&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">| localhost | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<\/span><\/span><\/p>\n<\/blockquote>\n<p><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">&nbsp;&nbsp; <\/span><span style=\"color: rgb(0, 128, 192); font-size: 12pt;\">\u6267\u884c\u4e0a\u8ff0\u8bed\u53e5\u540e\u7ed3\u679c<\/span><\/p>\n<blockquote>\n<p><span style=\"color: #0080c0;\"><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">mysql&gt; use mysql;<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">Database changed<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">mysql&gt; select host,user,password from user;<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">| host&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | user | password&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">| localhost&nbsp;&nbsp;&nbsp; | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">| 192.168.1.12 | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">2 rows in set (0.00 sec)<\/span><\/span><\/p>\n<\/blockquote>\n<p><span style=\"color: rgb(0, 128, 192); font-size: 12pt;\">&nbsp;<\/span><\/p>\n<p><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">&nbsp;&nbsp; \u53ef\u4ee5\u770b\u5230\u5728user\u8868\u4e2d\u5df2\u6709\u521a\u624d\u521b\u5efa\u7684root\u7528\u6237\u3002host\u5b57\u6bb5\u8868\u793a\u767b\u5f55\u7684\u4e3b\u673a\uff0c\u5176\u503c\u53ef\u4ee5\u7528IP\uff0c\u4e5f\u53ef\u7528\u4e3b\u673a\u540d\uff0c<\/span><\/p>\n<p><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">&nbsp;&nbsp; <\/span><span style=\"color: rgb(0, 128, 192); font-size: 12pt;\">(1)<\/span><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">\u6709\u65f6\u60f3\u7528\u672c\u5730IP\u767b\u5f55\uff0c\u90a3\u4e48\u53ef\u4ee5\u5c06\u4ee5\u4e0a\u7684Host\u503c\u6539\u4e3a\u81ea\u5df1\u7684Ip\u5373\u53ef\u3002<\/span><\/p>\n<p><span style=\"color: rgb(0, 128, 192); font-size: 12pt;\">2\u3001\u5b9e\u73b0\u8fdc\u7a0b\u8fde\u63a5(\u6388\u6743\u6cd5)<\/span><\/p>\n<p><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">&nbsp;&nbsp; \u5c06host\u5b57\u6bb5\u7684\u503c\u6539\u4e3a%\u5c31\u8868\u793a\u5728\u4efb\u4f55\u5ba2\u6237\u7aef\u673a\u5668\u4e0a\u80fd\u4ee5root\u7528\u6237\u767b\u5f55\u5230mysql\u670d\u52a1\u5668\uff0c\u5efa\u8bae\u5728\u5f00\u53d1\u65f6\u8bbe\u4e3a%\u3002&nbsp;&nbsp; <\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">&nbsp;&nbsp; update user set host = \u2019%\u2019 where user = \u2019root\u2019;<\/span><\/p>\n<p><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">&nbsp;&nbsp; \u5c06\u6743\u9650\u6539\u4e3aALL PRIVILEGES<\/span><\/p>\n<blockquote>\n<p><span style=\"color: #0080c0;\"><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">mysql&gt; use mysql;<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">Database changed<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">mysql&gt; grant all privileges&nbsp; on *.* to root@&#8217;%&#8217; identified by &#8220;root&#8221;;<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">Query OK, 0 rows affected (0.00 sec) <\/span><\/span><\/p>\n<p><span style=\"color: #0080c0;\"><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">mysql&gt; select host,user,password from user;<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">| host&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | user | password&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">| localhost&nbsp;&nbsp;&nbsp; | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">| 192.168.1.12 | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">| %&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<\/span><br \/><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">3 rows in set (0.00 sec)<\/span><\/span><\/p>\n<\/blockquote>\n<p><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">\u8fd9\u6837\u673a\u5668\u5c31\u53ef\u4ee5\u4ee5\u7528\u6237\u540droot\u5bc6\u7801root\u8fdc\u7a0b\u8bbf\u95ee\u8be5\u673a\u5668\u4e0a\u7684MySql.<\/span><\/p>\n<p><span style=\"color: rgb(0, 128, 192); font-size: 12pt;\">3\u3001\u5b9e\u73b0\u8fdc\u7a0b\u8fde\u63a5\uff08\u6539\u8868\u6cd5\uff09<\/span><\/p>\n<p><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">use mysql;<\/span><\/p>\n<p><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">update user set host = &#8216;%&#8217; where user = &#8216;root&#8217;;<\/span><\/p>\n<p><span data-wiz-span=\"data-wiz-span\" style=\"font-size: 12pt;\">\u8fd9\u6837\u5728\u8fdc\u7aef\u5c31\u53ef\u4ee5\u901a\u8fc7root\u7528\u6237\u8bbf\u95eeMysql.<\/span><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u8fdb\u5165mysql\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7528\u6237root,\u5bc6\u7801\u4e3aroot\uff1a &nbsp;&nbsp; \u683c\u5f0f\uff1agrant \u6743\u9650 &hellip; <a href=\"https:\/\/www.yclimw.com\/?p=646\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">MySql\u5b9e\u73b0\u8fdc\u7a0b\u8fde\u63a5<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[287,28],"class_list":["post-646","post","type-post","status-publish","format-standard","hentry","category-17","tag-mysql","tag-28"],"_links":{"self":[{"href":"https:\/\/www.yclimw.com\/index.php?rest_route=\/wp\/v2\/posts\/646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yclimw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yclimw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yclimw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yclimw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=646"}],"version-history":[{"count":2,"href":"https:\/\/www.yclimw.com\/index.php?rest_route=\/wp\/v2\/posts\/646\/revisions"}],"predecessor-version":[{"id":3097,"href":"https:\/\/www.yclimw.com\/index.php?rest_route=\/wp\/v2\/posts\/646\/revisions\/3097"}],"wp:attachment":[{"href":"https:\/\/www.yclimw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yclimw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yclimw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}