{"id":99,"date":"2021-08-05T10:36:05","date_gmt":"2021-08-05T02:36:05","guid":{"rendered":"https:\/\/www.miie.net\/?p=99"},"modified":"2021-08-05T10:36:05","modified_gmt":"2021-08-05T02:36:05","slug":"mysql-root-login-phpmyadmin","status":"publish","type":"post","link":"https:\/\/diji.net\/?p=99","title":{"rendered":"root\u7528\u6237\u5728phpMyAdmin\u4e0a\u767b\u9646\u51fa\u9519\u89e3\u51b3\u529e\u6cd5"},"content":{"rendered":"<p>\u5728phpMyAdmin\u7528root\u767b\u9646MySQL\u51fa\u9519\uff0c\u5bc6\u7801\u662f\u5bf9\u7684\u5c31\u662f\u767b\u4e0d\u4e0a\u3002\u63d0\u793a\uff1a<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">mysqli::real_connect(): (HY000\/1698): Access denied for user 'root'@'localhost'<\/pre>\n<p>\u5176\u5b9e\u5c31\u662froot\u7684\u9a8c\u8bc1\u65b9\u5f0f\u7684\u95ee\u9898\uff0c\u4ee5\u4e0b\u89e3\u51b3\u65b9\u6cd5\u5728MariaDB10.3\u4e2d\u9a8c\u8bc1\u6709\u6548\u3002\u63a8\u8350\u89e3\u51b3\u65b9\u6cd52\u3002<br \/>\n<strong>\u89e3\u51b3\u529e\u6cd51\uff1a<\/strong><br \/>\n\u53bb\u6389root\u7528\u6237\u7684\u9a8c\u8bc1\u63d2\u4ef6,\u6216\u8005\u9a8c\u8bc1\u65b9\u5f0f\u6539\u4e3amysql_native_password<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nUSE mysql;\nUPDATE user SET plugin=&quot;&quot; WHERE user=&quot;root&quot;; \n\/\/\u6216\u8005\nUPDATE user SET authentication_string=password(&quot;123456&quot;),plugin='mysql_native_password' WHERE user='root';\nFLUSH PRIVILEGES;\n\n\/\/\u5982\u679c\u8981\u6062\u590droot\u7684\u767b\u5f55\u9a8c\u8bc1\u65b9\u5f0f\u4f7f\u7528\u4ee5\u4e0b\u8bed\u53e5\u3002\u4e0d\u7528root\u7528\u6237\u767b\u9646\u662f\u5b89\u5168\u7684\u505a\u6cd5\u3002\nUPDATE user SET plugin=&quot;unix_socket&quot; WHERE user=&quot;root&quot;; \nFLUSH PRIVILEGES;\n<\/pre>\n<\/p>\n<p><strong>\u89e3\u51b3\u529e\u6cd52\uff1a<\/strong><br \/>\n\u65b0\u5efa\u4e00\u4e2a\u7528\u6237pmauser\u5e76\u7ed9\u4e88\u6700\u5927\u6743\u9650<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nCREATE USER 'pmauser'@'%' IDENTIFIED BY 'pmauser';\nGRANT ALL PRIVILEGES ON *.* TO 'pmauser'@'%' WITH GRANT OPTION;\n<\/pre><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728phpMyAdmin\u7528root\u767b\u9646MySQL\u51fa\u9519\uff0c\u5bc6\u7801\u662f\u5bf9\u7684\u5c31\u662f\u767b\u4e0d\u4e0a\u3002\u63d0\u793a\uff1a mysqli::real_connect(): (HY000\/1698): Access denied for user &#8216;root&#8217;@&#8217;localhost&#8217; \u5176\u5b9e\u5c31\u662froot\u7684\u9a8c\u8bc1\u65b9\u5f0f\u7684\u95ee\u9898\uff0c\u4ee5\u4e0b\u89e3\u51b3\u65b9\u6cd5\u5728MariaDB10.3\u4e2d\u9a8c\u8bc1\u6709\u6548\u3002\u63a8\u8350\u89e3\u51b3\u65b9\u6cd52\u3002 \u89e3\u51b3\u529e\u6cd51\uff1a \u53bb\u6389root\u7528\u6237\u7684\u9a8c\u8bc1\u63d2\u4ef6,\u6216\u8005\u9a8c\u8bc1\u65b9\u5f0f\u6539\u4e3amysql_native_password USE mysql; UPDATE user SET plugin=&quot;&quot; WHERE user=&quot;root&quot;; \/\/\u6216\u8005 UPDATE user SET authentication_string=password(&quot;123456&quot;),plugin=&#8217;mysql_native_password&#8217; WHERE user=&#8217;root&#8217;; FLUSH PRIVILEGES; \/\/\u5982\u679c\u8981\u6062\u590droot\u7684\u767b\u5f55\u9a8c\u8bc1\u65b9\u5f0f\u4f7f\u7528\u4ee5\u4e0b\u8bed\u53e5\u3002\u4e0d\u7528root\u7528\u6237\u767b\u9646\u662f\u5b89\u5168\u7684\u505a\u6cd5\u3002 UPDATE user SET plugin=&quot;unix_socket&quot; WHERE user=&quot;root&quot;; FLUSH PRIVILEGES; \u89e3\u51b3\u529e\u6cd52\uff1a \u65b0\u5efa\u4e00\u4e2a\u7528\u6237pmauser\u5e76\u7ed9\u4e88\u6700\u5927\u6743\u9650 CREATE USER &#8216;pmauser&#8217;@&#8217;%&#8217; IDENTIFIED BY &#8216;pmauser&#8217;; GRANT ALL PRIVILEGES ON *.* TO &#8216;pmauser&#8217;@&#8217;%&#8217; WITH GRANT OPTION;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-99","post","type-post","status-publish","format-standard","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/diji.net\/index.php?rest_route=\/wp\/v2\/posts\/99","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/diji.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/diji.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/diji.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/diji.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=99"}],"version-history":[{"count":0,"href":"https:\/\/diji.net\/index.php?rest_route=\/wp\/v2\/posts\/99\/revisions"}],"wp:attachment":[{"href":"https:\/\/diji.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=99"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/diji.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=99"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/diji.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=99"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}