{"id":55762,"date":"2023-06-29T17:55:13","date_gmt":"2023-06-29T09:55:13","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=55762"},"modified":"2023-06-29T17:55:13","modified_gmt":"2023-06-29T09:55:13","slug":"linux-reset-password","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-reset-password.html","title":{"rendered":"Linux \u4e2d\u91cd\u7f6e\u6570\u636e\u5e93\u7684 root \u5bc6\u7801\u7684\u6280\u5de7"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u5176\u4e2d\u4e00\u9879\u662f\u8bbe\u7f6e\u6570\u636e\u5e93 root \u5e10\u6237\u7684\u5bc6\u7801 - \u4f60\u5fc5\u987b\u4fdd\u6301\u79c1\u5bc6\uff0c\u5e76\u4ec5\u5728\u7edd\u5bf9\u9700\u8981\u65f6\u4f7f\u7528\u3002\u5982\u679c\u4f60\u5fd8\u8bb0\u4e86\u5bc6\u7801\u6216\u9700\u8981\u91cd\u7f6e\u5bc6\u7801\uff08\u4f8b\u5982\uff0c\u5f53\u6570\u636e\u5e93\u7ba1\u7406\u5458\u6362\u4eba\u6216\u88ab\u88c1\u5458\uff01\uff09\uff0c\u8fd9\u7bc7\u6587\u7ae0\u4f1a\u6d3e\u4e0a\u7528\u573a\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u5982\u679c\u4f60\u662f\u7b2c\u4e00\u6b21\u8bbe\u7f6e MySQL \u6216 MariaDB \u6570\u636e\u5e93\uff0c\u4f60\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c mysql_secure_installation \u6765\u5b9e\u73b0\u57fa\u672c\u7684\u5b89\u5168\u8bbe\u7f6e\u3002<\/p>\n

\"\u5982\u4f55\u5728<\/p>\n

\u5176\u4e2d\u4e00\u9879\u662f\u8bbe\u7f6e\u6570\u636e\u5e93 root \u5e10\u6237\u7684\u5bc6\u7801 - \u4f60\u5fc5\u987b\u4fdd\u6301\u79c1\u5bc6\uff0c\u5e76\u4ec5\u5728\u7edd\u5bf9\u9700\u8981\u65f6\u4f7f\u7528\u3002\u5982\u679c\u4f60\u5fd8\u8bb0\u4e86\u5bc6\u7801\u6216\u9700\u8981\u91cd\u7f6e\u5bc6\u7801\uff08\u4f8b\u5982\uff0c\u5f53\u6570\u636e\u5e93\u7ba1\u7406\u5458\u6362\u4eba\u6216\u88ab\u88c1\u5458\uff01\uff09\uff0c\u8fd9\u7bc7\u6587\u7ae0\u4f1a\u6d3e\u4e0a\u7528\u573a\u3002\u6211\u4eec\u5c06\u89e3\u91ca\u5982\u4f55\u5728 Linux \u4e2d\u91cd\u7f6e\u6216\u6062\u590d MySQL \u6216 MariaDB \u7684 root \u5bc6\u7801\u3002<\/p>\n

\u5efa\u8bae\u9605\u8bfb\uff1a\u66f4\u6539 MySQL \u6216 MariaDB \u7684 root \u5bc6\u7801\u3002<\/p>\n

\u867d\u7136\u6211\u4eec\u5c06\u5728\u672c\u6587\u4e2d\u4f7f\u7528 MariaDB\uff0c\u4f46\u8fd9\u4e9b\u8bf4\u660e\u540c\u6837\u4e5f\u9002\u7528\u4e8e MySQL\u3002<\/p>\n

\u6062\u590d MySQL \u6216\u8005 MariaDB \u7684 root \u5bc6\u7801<\/strong><\/div>\n

\u5f00\u59cb\u4e4b\u524d\uff0c\u5148\u505c\u6b62\u6570\u636e\u5e93\u670d\u52a1\u5e76\u68c0\u67e5\u670d\u52a1\u72b6\u6001\uff0c\u6211\u4eec\u5e94\u8be5\u53ef\u4ee5\u770b\u5230\u5148\u524d\u8bbe\u7f6e\u7684\u73af\u5883\u53d8\u91cf\uff1a<\/p>\n

------------- SystemD ------------- \r\n# systemctl stop mariadb\r\n------------- SysVinit -------------\r\n# \/etc\/init.d\/mysqld stop\r\n<\/pre>\n

\u63a5\u4e0b\u6765\uff0c\u7528--skip-grant-tables\u9009\u9879\u542f\u52a8\u670d\u52a1\uff1a<\/p>\n

------------- SystemD ------------- \r\n# systemctl set-environment MYSQLD_OPTS=\"--skip-grant-tables\"\r\n# systemctl start mariadb\r\n# systemctl status mariadb\r\n------------- SysVinit -------------\r\n# mysqld_safe --skip-grant-tables &\r\n<\/pre>\n

\"\u5982\u4f55\u5728
\n\u4f7f\u7528 skip tables \u542f\u52a8 MySQL\/MariaDB<\/em><\/p>\n

\u8fd9\u53ef\u4ee5\u8ba9\u4f60\u4e0d\u7528 root \u5bc6\u7801\u5c31\u80fd\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u4f60\u4e5f\u8bb8\u9700\u8981\u5207\u6362\u5230\u53e6\u5916\u4e00\u4e2a\u7ec8\u7aef\u4e0a\uff09\uff1a<\/p>\n

# mysql -u root\r\n<\/pre>\n

\u63a5\u4e0b\u6765\uff0c\u6309\u7167\u4e0b\u9762\u5217\u51fa\u7684\u6b65\u9aa4\u6765\u3002<\/p>\n

>MariaDB [(none)]> USE mysql;\r\nMariaDB [(none)]> UPDATE user SET password=PASSWORD('YourNewPasswordHere') WHERE User='root' AND Host = 'localhost';\r\nMariaDB [(none)]> FLUSH PRIVILEGES;\r\n<\/pre>\n

\u6700\u540e\uff0c\u505c\u6b62\u670d\u52a1\uff0c\u53d6\u6d88\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u5e76\u518d\u6b21\u542f\u52a8\u670d\u52a1\uff1a<\/p>\n

------------- SystemD ------------- \r\n# systemctl stop mariadb\r\n# systemctl unset-environment MYSQLD_OPTS\r\n# systemctl start mariadb\r\n------------- SysVinit -------------\r\n# \/etc\/init.d\/mysql stop\r\n# \/etc\/init.d\/mysql start\r\n<\/pre>\n

\u8fd9\u53ef\u4ee5\u8ba9\u5148\u524d\u7684\u6539\u53d8\u751f\u6548\uff0c\u5141\u8bb8\u4f60\u4f7f\u7528\u65b0\u7684\u5bc6\u7801\u8fde\u63a5\u5230\u6570\u636e\u5e93\u3002<\/p>\n

\u603b\u7ed3<\/strong><\/div>\n

\u672c\u6587\u6211\u4eec\u8ba8\u8bba\u4e86\u5982\u4f55\u91cd\u7f6e MariaDB\/MySQL \u7684 root \u5bc6\u7801\u3002\u4e00\u5982\u5f80\u5e38\uff0c\u5982\u679c\u4f60\u6709\u4efb\u4f55\u95ee\u9898\u6216\u53cd\u9988\u8bf7\u5728\u8bc4\u8bba\u680f\u4e2d\u7ed9\u6211\u4eec\u7559\u8a00\u3002\u6211\u4eec\u671f\u5f85\u542c\u5230\u4f60\u7684\u58f0\u97f3\u3002<\/p>\n


\n

via: http:\/\/www.tecmint.com\/reset-mysql-or-mariadb-root-password\/<\/a><\/p>\n

\u4f5c\u8005\uff1aGabriel C\u00e1nepa<\/a> \u8bd1\u8005\uff1ageekpi<\/a> \u6821\u5bf9\uff1ajasminepeng<\/a><\/p>\n

\u672c\u6587\u7531 LCTT<\/a> \u539f\u521b\u7f16\u8bd1\uff0cLinux\u4e2d\u56fd<\/a> \u8363\u8a89\u63a8\u51fa<\/p>\n

\n

\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/linux.cn\/article-8301-1.html<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttp:\/\/lrxjmw.cn\/linux-reset-password.html<\/a>\u7f16\u8f91\u5458\uff1a\u90ed\u5efa\u9e4f\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5982\u679c\u4f60\u662f\u7b2c\u4e00\u6b21\u8bbe\u7f6e MySQL \u6216 MariaDB \u6570\u636e\u5e93\uff0c\u4f60\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c mysql_secure_installation \u6765\u5b9e\u73b0\u57fa\u672c\u7684\u5b89\u5168\u8bbe\u7f6e\u3002<\/p>\n","protected":false},"author":323,"featured_media":58566,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-55762","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/55762","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/323"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=55762"}],"version-history":[{"count":6,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/55762\/revisions"}],"predecessor-version":[{"id":276183,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/55762\/revisions\/276183"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/58566"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=55762"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=55762"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=55762"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}