{"id":254,"date":"2016-12-11T20:41:34","date_gmt":"2016-12-11T12:41:34","guid":{"rendered":"https:\/\/blog.freesilo.com\/?p=254"},"modified":"2016-12-11T20:41:34","modified_gmt":"2016-12-11T12:41:34","slug":"mysql%e7%94%a8%e6%88%b7%e8%b4%a6%e6%88%b7%e7%ae%a1%e7%90%86","status":"publish","type":"post","link":"https:\/\/freesilo.com\/?p=254","title":{"rendered":"MySQL\u7528\u6237\u8d26\u6237\u7ba1\u7406"},"content":{"rendered":"<h4>MySQL\u7528\u6237\u8d26\u6237\u7ba1\u7406<\/h4>\n<h4>1.MySQL \u7528\u6237\u540d\u548c\u5bc6\u7801<\/h4>\n<div>\n<p>MySQL\u4e2dmysql\u6570\u636e\u5e93\u7684user\u8868\u4e2d\u5b58\u50a8\u7528\u6237\uff0c\u4e00\u4e2a\u5e10\u53f7\u88ab\u5b9a\u4e49\u6839\u636e\u8fde\u63a5\u5230\u670d\u52a1\u5668\u7684\u4e00\u4e2a\u7528\u6237\u540d\u548c\u5ba2\u6237\u7aef\u4e3b\u673a\u6216\u4e3b\u673a\u540d\uff0c\u8fd9\u4e2a\u5e10\u53f7\u4e5f\u6709\u4e00\u4e2a\u5bc6\u7801\uff0c\u66f4\u591a\u7684\u4fe1\u606f\u5728user\u8868\u4e2d\u67e5\u8be2\u3002<\/p>\n<p>2.\u6dfb\u52a0\u7528\u6237\u8d26\u6237<\/p>\n<p>\u521b\u5efaMySQL\u5e10\u53f7\u7684\u4e24\u79cd\u65b9\u5f0f<\/p>\n<p>\u4f7f\u7528\u8bed\u53e5\u521b\u5efa\u8d26\u6237\uff1aCREATE USER \u6216GRANT<\/p>\n<p>\u521b\u5efa\u7528\u6237<br \/>\nmysql&gt; <b>CREATE USER &#8216;monty&#8217;@&#8217;localhost&#8217; IDENTIFIED BY &#8216;some_pass&#8217;<\/b><br \/>\nmysql&gt; <b>GRANT ALL PRIVILEGES ON *.* TO &#8216;monty&#8217;@&#8217;localhost&#8217;<\/b><br \/>\n-&gt; <b>WITH GRANT OPTION;<\/b><br \/>\nmysql&gt; <b>CREATE USER &#8216;monty&#8217;@&#8217;%&#8217; IDENTIFIED BY &#8216;some_pass&#8217;;<\/b><br \/>\nmysql&gt; <b>GRANT ALL PRIVILEGES ON *.* TO &#8216;monty&#8217;@&#8217;%&#8217;<\/b><br \/>\n-&gt; <b>WITH GRANT OPTION;<\/b><br \/>\nmysql&gt; <b>CREATE USER &#8216;admin&#8217;@&#8217;localhost&#8217;;<\/b><br \/>\nmysql&gt; <b>GRANT RELOAD,PROCESS ON *.* TO &#8216;admin&#8217;@&#8217;localhost&#8217;;<\/b><br \/>\nmysql&gt; <b><b>CREATE USER &#8216;dummy&#8217;@&#8217;localhost&#8217;;<\/b><\/b><\/p>\n<p>mysql\u6743\u9650\u5217\u8868<\/p>\n<table border=\"1\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<p align=\"left\"><strong>\u6743\u9650<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u6743\u9650\u7ea7\u522b<\/strong><\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\"><strong>\u6743\u9650\u8bf4\u660e<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">CREATE<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u6570\u636e\u5e93\u3001\u8868\u6216\u7d22\u5f15<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u521b\u5efa\u6570\u636e\u5e93\u3001\u8868\u6216\u7d22\u5f15\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">DROP<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u6570\u636e\u5e93\u6216\u8868<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u5220\u9664\u6570\u636e\u5e93\u6216\u8868\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">GRANT OPTION<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u6570\u636e\u5e93\u3001\u8868\u6216\u4fdd\u5b58\u7684\u7a0b\u5e8f<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u8d4b\u4e88\u6743\u9650\u9009\u9879<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">REFERENCES<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u6570\u636e\u5e93\u6216\u8868<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\"><\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">ALTER<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u8868<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u66f4\u6539\u8868\uff0c\u6bd4\u5982\u6dfb\u52a0\u5b57\u6bb5\u3001\u7d22\u5f15\u7b49<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">DELETE<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u8868<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u5220\u9664\u6570\u636e\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">INDEX<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"left\">\u8868<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u7d22\u5f15\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">INSERT<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"left\">\u8868<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u63d2\u5165\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">SELECT<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"left\">\u8868<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u67e5\u8be2\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">UPDATE<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"left\">\u8868<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u66f4\u65b0\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">CREATE VIEW<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u89c6\u56fe<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u521b\u5efa\u89c6\u56fe\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">SHOW VIEW<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u89c6\u56fe<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u67e5\u770b\u89c6\u56fe\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">ALTER ROUTINE<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"left\">\u5b58\u50a8\u8fc7\u7a0b<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u66f4\u6539\u5b58\u50a8\u8fc7\u7a0b\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">CREATE ROUTINE<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"left\">\u5b58\u50a8\u8fc7\u7a0b<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u521b\u5efa\u5b58\u50a8\u8fc7\u7a0b\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">EXECUTE<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"left\">\u5b58\u50a8\u8fc7\u7a0b<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u6267\u884c\u5b58\u50a8\u8fc7\u7a0b\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">FILE<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u670d\u52a1\u5668\u4e3b\u673a\u4e0a\u7684\u6587\u4ef6\u8bbf\u95ee<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u6587\u4ef6\u8bbf\u95ee\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">CREATE TEMPORARY TABLES<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u670d\u52a1\u5668\u7ba1\u7406<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u521b\u5efa\u4e34\u65f6\u8868\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">LOCK TABLES<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"left\">\u670d\u52a1\u5668\u7ba1\u7406<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u9501\u8868\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">CREATE USER<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"left\">\u670d\u52a1\u5668\u7ba1\u7406<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u521b\u5efa\u7528\u6237\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">PROCESS<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"left\">\u670d\u52a1\u5668\u7ba1\u7406<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u67e5\u770b\u8fdb\u7a0b\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">RELOAD<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"left\">\u670d\u52a1\u5668\u7ba1\u7406<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\u6267\u884cflush-hosts, flush-logs, flush-privileges, flush-status, flush-tables, flush-threads, refresh, reload\u7b49\u547d\u4ee4\u7684\u6743\u9650<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">REPLICATION CLIENT<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"left\">\u670d\u52a1\u5668\u7ba1\u7406<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u590d\u5236\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">REPLICATION SLAVE<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"left\">\u670d\u52a1\u5668\u7ba1\u7406<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u590d\u5236\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">SHOW DATABASES<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"left\">\u670d\u52a1\u5668\u7ba1\u7406<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u67e5\u770b\u6570\u636e\u5e93\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">SHUTDOWN<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"left\">\u670d\u52a1\u5668\u7ba1\u7406<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u5173\u95ed\u6570\u636e\u5e93\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">SUPER<\/p>\n<\/td>\n<td valign=\"top\">\n<p align=\"left\">\u670d\u52a1\u5668\u7ba1\u7406<\/p>\n<\/td>\n<td valign=\"top\" width=\"177\">\n<p align=\"left\">\u6267\u884ckill\u7ebf\u7a0b\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>\u8bbe\u7f6e\u5bc6\u7801<br \/>\nmysql&gt; <b>SET PASSWORD FOR<\/b><br \/>\n-&gt; <b>&#8216;jeffrey&#8217;@&#8217;localhost&#8217; = PASSWORD(&#8216;mypass&#8217;);<\/b><br \/>\nmysql&gt; <b>SET PASSWORD = PASSWORD(&#8216;mypass&#8217;);<\/b><\/p>\n<p>\u5220\u9664\u7528\u6237<br \/>\nDROP USER &#8216;jeffrey&#8217;@&#8217;localhost&#8217;;<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>MySQL\u7528\u6237\u8d26\u6237\u7ba1\u7406 1.MySQL \u7528\u6237\u540d\u548c\u5bc6\u7801 MySQL\u4e2dmysql\u6570\u636e&#8230;<br \/><a class=\"read-more-button\" href=\"https:\/\/freesilo.com\/?p=254\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-254","post","type-post","status-publish","format-standard","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/posts\/254","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/freesilo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=254"}],"version-history":[{"count":2,"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/posts\/254\/revisions"}],"predecessor-version":[{"id":286,"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/posts\/254\/revisions\/286"}],"wp:attachment":[{"href":"https:\/\/freesilo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/freesilo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/freesilo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}