{"id":180,"date":"2010-11-07T16:32:25","date_gmt":"2010-11-07T08:32:25","guid":{"rendered":"http:\/\/www.myvoipapp.com\/blogs\/yxh\/?p=180"},"modified":"2023-11-18T16:14:41","modified_gmt":"2023-11-18T08:14:41","slug":"%e8%bf%9c%e7%a8%8b%e8%ae%bf%e9%97%aemysql%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/2010\/11\/07\/%e8%bf%9c%e7%a8%8b%e8%ae%bf%e9%97%aemysql%e6%95%b0%e6%8d%ae%e5%ba%93\/","title":{"rendered":"\u8fdc\u7a0b\u8bbf\u95eeMySQL\u6570\u636e\u5e93"},"content":{"rendered":"\n<p>Linux\u7248\u672c\u7684MySQL\u6570\u636e\u5e93\u7f3a\u7701\u4e0d\u5141\u8bb8\u4ece\u8fdc\u7a0b\u8bbf\u95ee\uff08Windows\u7248\u672c\u5728\u5b89\u88c5\u65f6\u53ef\u4ee5\u8fdb\u884c\u9009\u62e9\uff09\uff0c\u56e0\u6b64\u6211\u4eec\u9700\u8981\u7b80\u5355\u4fee\u6539\u4e00\u4e0b\u6765\u653e\u5f00\u8fd9\u4e2a\u9650\u5236\u3002<\/p>\n\n\n\n<p>\u901a\u8fc7\u8f6f\u4ef6\u4e2d\u5fc3\u5b89\u88c5MySQL\uff0c\u8fd9\u6ca1\u6709\u4ec0\u4e48\u597d\u4ecb\u7ecd\u7684\u3002\u7f51\u4e0a\u6709\u4e9b\u8fd9\u65b9\u9762\u7684\u4ecb\u7ecd\uff0c\u4e0d\u8fc7\u4e2d\u6587\u7248\u672c\u7684\u57fa\u672c\u4e0a\u90fd\u6709\u4e9b\u9519\u8bef\uff0c\u4f30\u8ba1\u5927\u90e8\u5206\u90fd\u53ea\u662f\u8f6c\u8f7d\uff0c\u4f5c\u8005\u5e76\u6ca1\u6709\u771f\u6b63\u5c1d\u8bd5\u3002<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u6b65\u9aa4\u57fa\u4e8eUbuntu\u7248\u672c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">step1\uff1amysql&gt; grant all privileges on *.* to 'root'@'%' identified by '1234';<\/pre>\n\n\n\n<p>\u5176\u4e2d\uff0c\u20181234\u2019\u662f\u6307\u5bc6\u7801\uff0c\u2018root\u2018\u662f\u6307\u8fdc\u7a0b\u8bbf\u95ee\u7684\u8d26\u6237\u540d\u3002&#8217;%&#8217;\u662f\u6307\u5141\u8bb8\u4ece\u4efb\u4f55\u4e00\u4e2a\u8fdc\u7a0b\u8ba1\u7b97\u673a\u8bbf\u95ee\u3002&#8217;*.*&#8217;\u662f\u6307\u6240\u6709\u6570\u636e\u5e93\u3001\u6240\u6709\u8868\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">step2\uff1amysql&gt; flush privileges;<\/pre>\n\n\n\n<p>step3\uff1a\u4fee\u6539\/etc\/mysql\/my.cnf\u6587\u4ef6\uff0c\u6ce8\u91ca\u6389\u4ee5\u4e0b\u884c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">bind-address&nbsp;&nbsp;&nbsp;&nbsp; = 127.0.0.1<\/pre>\n\n\n\n<p>step4: \u91cd\u542fMySQL\u670d\u52a1<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo service mysql restart<\/pre>\n\n\n\n<p>\u5b8c\u6210\u4e0a\u8ff0\u6b65\u9aa4\u540e\uff0c\u5c31\u53ef\u4ee5\u7528root\u8d26\u6237\uff0c\u4ee5\u20181234\u2019\u4e3apassword\uff0c\u4ece\u4efb\u4f55\u4e00\u4e2a\u8fdc\u7aef\u8ba1\u7b97\u673a\u4e0a\u767b\u5f55\u5e76\u8bbf\u95eeMySQL\u6570\u636e\u5e93\u4e86\u3002<\/p>\n\n\n\n<p><strong>2018-09-29 \u66f4\u65b0<\/strong>, Debian 9\u4e4b\u540e\u53c8\u6709\u4e86\u5f88\u591a\u53d8\u5316:<\/p>\n\n\n\n<p>\u6700\u5927\u7684\u53d8\u5316\u83ab\u8fc7\u4e8eMariaDB\u6b63\u5f0f\u66ff\u6362\u4e86MySQL\uff0c\u5f53\u7136mariadb\u7684\u5404\u9879\u64cd\u4f5c\u3001\u5e93\uff08\u5c24\u5176\u662f\u57fa\u672c\u7684\u64cd\u4f5c\u548c\u57fa\u672c\u5e93\uff09\u4e0eMySQL\u8fd8\u662f\u4fdd\u6301\u517c\u5bb9\u3002\u540c\u65f6\uff0c\u914d\u7f6e\u6587\u4ef6\u53d8\u66f4\u4e3a \/etc\/mysql\/mariadb.conf.d\/50-server.cnf\u3002<\/p>\n\n\n\n<p>\u5728\u5b8c\u6210\u4e0a\u8ff0\u90a3\u4e9b\u64cd\u4f5c\u540e\uff0c\u5728\u5176\u4ed6\u7528\u6237\u7684shell\u91cc\uff0c\u4f7f\u7528root\u8d26\u53f7\u767b\u5f55MariaDB\uff0c\u4f1a\u63d0\u793a\u4ee5\u4e0b\u4fe1\u606f\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>ERROR 1698 (28000): Access denied for user &#8216;root&#8217;@&#8217;localhost&#8217;<\/p>\n<\/blockquote>\n\n\n\n<p>\u800c\u76f4\u63a5\u5728root\u7528\u6237\u7684shell\u91cc\u767b\u5f55\u662f\u6ca1\u6709\u95ee\u9898\u7684\u3002\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0croot\u8981\u767b\u5f55\u8fdbMariaDB\u540e\uff0c\u9009\u62e9\u201cmysql\u201d\u6570\u636e\u5e93\uff0c\u7136\u540e<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">update user set password=password('1234') where user='root' and host='localhost';<\/pre>\n\n\n\n<p>\u6b64\u65f6\u8bbe\u7f6e\u4ece\u672c\u673a\u767b\u5f55\u65f6\uff0croot\u7528\u6237\u7684\u5bc6\u7801\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">update user set plugin='' where user='root';\nflush privileges;<\/pre>\n\n\n\n<p>\u6e05\u9664root\u7528\u6237\u7684plugin\u5b57\u6bb5\uff0c\u5141\u8bb8root\u7528\u6237\u4ece\u5176\u4ed6shell\u91cc\u767b\u5f55\u3002<\/p>\n\n\n\n<p>\u53e6\u5916\u8981\u6ce8\u610f\u7684\u662f\uff0c\u91cd\u65b0\u542f\u52a8MariaDB\uff0c\u547d\u4ee4\u4e5f\u6709\u53d8\u6362\uff0c\u91c7\u7528 systemctl \u8fdb\u884c\u64cd\u4f5c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">systemctl stop mariadb.service\nsystemctl start mariadb.service<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Linux\u7248\u672c\u7684MySQL\u6570\u636e\u5e93\u7f3a\u7701\u4e0d\u5141\u8bb8\u4ece\u8fdc\u7a0b\u8bbf\u95ee\uff08Windows\u7248\u672c\u5728\u5b89\u88c5\u65f6\u53ef\u4ee5\u8fdb\u884c\u9009\u62e9\uff09\uff0c\u56e0\u6b64\u6211\u4eec\u9700\u8981\u7b80\u5355\u4fee\u6539\u4e00\u4e0b\u6765\u653e\u5f00\u8fd9\u4e2a\u9650\u5236\u3002 \u901a\u8fc7\u8f6f\u4ef6\u4e2d\u5fc3\u5b89\u88c5MyS&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.myvoipapp.com\/blogs\/yxh\/2010\/11\/07\/%e8%bf%9c%e7%a8%8b%e8%ae%bf%e9%97%aemysql%e6%95%b0%e6%8d%ae%e5%ba%93\/\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[276,10,52,707,706],"class_list":["post-180","post","type-post","status-publish","format-standard","hentry","category-6","tag-mariadb","tag-mysql","tag-root","tag-systemctl","tag-user"],"_links":{"self":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts\/180","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/comments?post=180"}],"version-history":[{"count":5,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts\/180\/revisions"}],"predecessor-version":[{"id":2565,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts\/180\/revisions\/2565"}],"wp:attachment":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/media?parent=180"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/categories?post=180"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/tags?post=180"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}