{"id":579,"date":"2022-03-10T11:29:47","date_gmt":"2022-03-10T03:29:47","guid":{"rendered":"https:\/\/22pig.com\/?p=579"},"modified":"2022-03-10T11:29:47","modified_gmt":"2022-03-10T03:29:47","slug":"%e5%ae%89%e8%a3%85mysql","status":"publish","type":"post","link":"http:\/\/22pig.com\/?p=579","title":{"rendered":"\u5b89\u88c5MySQL"},"content":{"rendered":"<div>8 \u5b89\u88c5MySQL<\/div>\n<div>cd ~<\/div>\n<div>wget https:\/\/dev.mysql.com\/get\/mysql57-community-release-el7-9.noarch.rpm rpm -ivh mysql57-community-release-el7-9.noarch.rpm cd \/etc\/yum.repos.d\/<\/div>\n<div>yum install mysql-server<\/div>\n<div>#\u542f\u52a8<\/div>\n<div>systemctl enable mysqld<\/div>\n<div>systemctl start mysqld<\/div>\n<div><\/div>\n<div>\n<ol>\n<li>vi \/etc\/my.cnf<\/li>\n<li>\u5728 [mysqld]\u6700\u540e\u52a0\u4e0a skip-grant-tables\uff08\u624b\u6572\uff09<\/li>\n<li>service mysqld restart<\/li>\n<li>mysql -uroot -p \u56de\u8f66<\/li>\n<li>&gt;use mysql;<\/li>\n<li>update user set authentication_string=password(&#8216;\u5bc6\u7801&#8217;) where user=&#8217;root&#8217;;<\/li>\n<li>\u4fee\u6539\u56de\u539f\u6765\u914d\u7f6e\uff0c \u518d\u6b21\u767b\u9646\u540e\uff0c\u518d\u6539\u4e00\u6b21\u5bc6\u7801<\/li>\n<li>mysql -uroot -p\u6211\u7684\u5bc6\u7801<\/li>\n<\/ol>\n<\/div>\n<div>alter user user() identified by &#8216;\u5bc6\u7801&#8217;;<\/div>\n<div><\/div>\n<div>\u5f00\u653e\u5c40\u57df\u7f51\u8bbf\u95ee\uff1a<\/div>\n<div>use mysql;<\/div>\n<div>update user set host =&#8217;%&#8217; where user = &#8216;root&#8217;;<\/div>\n<div>flush privileges;<\/div>\n<div>select host,user from user;<\/div>\n<div><\/div>\n<div>#mysql \u5f00\u53ea\u8bfb\u8d26\u53f7<\/div>\n<div>GRANT ALL PRIVILEGES ON *.* TO &#8220;root&#8221;@&#8221;localhost&#8221; IDENTIFIED BY &#8220;\u5bc6\u7801&#8221; WITH GRANT OPTION;<\/div>\n<div>GRANT ALL PRIVILEGES ON *.* TO &#8220;root&#8221;@&#8221;192.168.0.204&#8221; IDENTIFIED BY &#8220;\u5bc6\u7801&#8221; WITH GRANT OPTION;<\/div>\n<div>flush privileges;<\/div>\n<div><\/div>\n<div>GRANT Select ON \u6570\u636e\u5e93\u540d.* TO reader@&#8221;%&#8221; IDENTIFIED BY &#8220;\u53ea\u8bfb\u5bc6\u7801&#8221;;\u00a0 \u00a0 &#8211;\u53ea\u6709select \u6743\u9650<\/div>\n<div><\/div>\n<div id=\"5lle-1646882720886\">\u6dfb\u52a0\u8fdc\u7a0bip\u8bbf\u95ee\u6743\u9650<\/div>\n<div data-theme=\"default\" data-language=\"javascript\">GRANT ALL PRIVILEGES ON *.* TO &#8216;root&#8217;@&#8217;10.10.10.10&#8217; IDENTIFIED BY &#8216;\u5bc6\u7801&#8217; WITH GRANT OPTION;<\/div>\n<div data-theme=\"default\" data-language=\"javascript\">flush privileges;<\/div>\n<div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>8 \u5b89\u88c5MySQL cd ~ wget https:\/\/dev.mysql.com\/get\/mysql57-community-release-el7-9.noarch.rpm rpm -ivh mysql57-community-release-el7-9.noarch.rpm cd \/etc\/yum.repos.d\/ yum install mysql-server #\u542f\u52a8 systemctl enable mysqld systemctl start mysqld vi \/etc\/my.cnf \u5728 [mysqld]\u6700\u540e\u52a0\u4e0a skip-grant-tables\uff08\u624b\u6572\uff09 service mysqld restart mysql -uroot -p \u56de\u8f66 &gt;use mysql; update user set authentication_string=password(&#8216;\u5bc6\u7801&#8217;) where user=&#8217;root&#8217;; \u4fee\u6539\u56de\u539f\u6765\u914d\u7f6e\uff0c \u518d\u6b21\u767b\u9646\u540e\uff0c\u518d\u6539\u4e00\u6b21\u5bc6\u7801 mysql -uroot -p\u6211\u7684\u5bc6\u7801 alter user user() identified by &#8216;\u5bc6\u7801&#8217;; \u5f00\u653e\u5c40\u57df\u7f51\u8bbf\u95ee\uff1a use mysql; &#8230; <a title=\"\u5b89\u88c5MySQL\" class=\"read-more\" href=\"http:\/\/22pig.com\/?p=579\" aria-label=\"More on \u5b89\u88c5MySQL\">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":[7],"tags":[],"class_list":["post-579","post","type-post","status-publish","format-standard","hentry","category-java"],"_links":{"self":[{"href":"http:\/\/22pig.com\/index.php?rest_route=\/wp\/v2\/posts\/579","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/22pig.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/22pig.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/22pig.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/22pig.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=579"}],"version-history":[{"count":0,"href":"http:\/\/22pig.com\/index.php?rest_route=\/wp\/v2\/posts\/579\/revisions"}],"wp:attachment":[{"href":"http:\/\/22pig.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=579"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/22pig.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=579"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/22pig.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=579"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}