{"id":56480,"date":"2023-07-03T06:21:15","date_gmt":"2023-07-02T22:21:15","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=56480"},"modified":"2023-07-03T06:21:15","modified_gmt":"2023-07-02T22:21:15","slug":"linux-dbroot-password","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-dbroot-password.html","title":{"rendered":"Linux\u4e0b\u8f7b\u677e\u4fee\u6539MySQL\/MariaDB\u7684Root\u5bc6\u7801"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u5982\u679c\u4f60\u662f\u7b2c\u4e00\u6b21\u5b89\u88c5 MySQL \u6216 MariaDB\uff0c\u4f60\u53ef\u4ee5\u6267\u884c mysql_secure_installation \u811a\u672c\u6765\u5b9e\u73b0\u57fa\u672c\u7684\u5b89\u5168\u8bbe\u7f6e\u3002\u5176\u4e2d\u7684\u4e00\u4e2a\u8bbe\u7f6e\u662f\u6570\u636e\u5e93\u7684 root \u5bc6\u7801 \u2014\u2014 \u8be5\u5bc6\u7801\u5fc5\u987b\u4fdd\u5bc6\uff0c\u5e76\u4e14\u53ea\u5728\u5fc5\u8981\u7684\u65f6\u5019\u4f7f\u7528\u3002\u5982\u679c\u4f60\u9700\u8981\u4fee\u6539\u5b83\uff08\u4f8b\u5982\uff0c\u5f53\u6570\u636e\u5e93\u7ba1\u7406\u5458\u6362\u4e86\u4eba \u2014\u2014 \u6216\u8005\u88ab\u89e3\u96c7\u4e86\uff01\uff09\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\u5728<\/p>\n

\u4fee\u6539 MySQL \u6216 MariaDB \u7684 root \u5bc6\u7801<\/strong><\/div>\n

\u4f60\u77e5\u9053 root \u5bc6\u7801\uff0c\u4f46\u662f\u60f3\u8981\u91cd\u7f6e\u5b83\uff0c\u5bf9\u4e8e\u8fd9\u6837\u7684\u60c5\u51b5\uff0c\u8ba9\u6211\u4eec\u9996\u5148\u786e\u5b9a MariaDB \u6b63\u5728\u8fd0\u884c\uff1a<\/p>\n

------------- CentOS\/RHEL 7 and Fedora 22+ ------------- \r\n# systemctl is-active mariadb\r\n------------- CentOS\/RHEL 6 and Fedora -------------\r\n# \/etc\/init.d\/mysqld status\r\n<\/pre>\n

\"\u5728<\/p>\n

\u68c0\u67e5 MysQL \u72b6\u6001<\/p>\n

\u5982\u679c\u4e0a\u9762\u7684\u547d\u4ee4\u8fd4\u56de\u4e2d\u6ca1\u6709 active \u8fd9\u4e2a\u5173\u952e\u8bcd\uff0c\u90a3\u4e48\u8be5\u670d\u52a1\u5c31\u662f\u505c\u6b62\u72b6\u6001\uff0c\u4f60\u9700\u8981\u5728\u8fdb\u884c\u4e0b\u4e00\u6b65\u4e4b\u524d\u5148\u542f\u52a8\u6570\u636e\u5e93\u670d\u52a1\uff1a<\/p>\n

------------- CentOS\/RHEL 7 and Fedora 22+ ------------- \r\n# systemctl start mariadb\r\n------------- CentOS\/RHEL 6 and Fedora -------------\r\n# \/etc\/init.d\/mysqld start\r\n<\/pre>\n

\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u4ee5 root \u767b\u5f55\u8fdb\u6570\u636e\u5e93\u670d\u52a1\u5668\uff1a<\/p>\n

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

\u4e3a\u4e86\u517c\u5bb9\u4e0d\u540c\u7248\u672c\uff0c\u6211\u4eec\u5c06\u4f7f\u7528\u4e0b\u9762\u7684\u58f0\u660e\u6765\u66f4\u65b0 mysql \u6570\u636e\u5e93\u7684\u7528\u6237\u8868\u3002\u6ce8\u610f\uff0c\u4f60\u9700\u8981\u5c06 YourPasswordHere \u66ff\u6362\u4e3a\u4f60\u4e3a root \u9009\u62e9\u7684\u65b0\u5bc6\u7801\u3002<\/p>\n

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

\u8981\u9a8c\u8bc1\u662f\u5426\u64cd\u4f5c\u6210\u529f\uff0c\u8bf7\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u9000\u51fa\u5f53\u524d MariaDB \u4f1a\u8bdd\u3002<\/p>\n

MariaDB [(none)]> exit;\r\n<\/pre>\n

\u7136\u540e\uff0c\u6572\u56de\u8f66\u3002\u4f60\u73b0\u5728\u5e94\u8be5\u53ef\u4ee5\u4f7f\u7528\u65b0\u5bc6\u7801\u8fde\u63a5\u5230\u670d\u52a1\u5668\u4e86\u3002<\/p>\n

\"\u5728<\/p>\n

\u4fee\u6539 MysQL\/MariaDB Root \u5bc6\u7801<\/p>\n

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

\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u8bf4\u660e\u4e86\u5982\u4f55\u4fee\u6539 MariaDB \/ MySQL \u7684 root \u5bc6\u7801 \u2014\u2014 \u6216\u8bb8\u4f60\u77e5\u9053\u5f53\u524d\u6240\u8bb2\u7684\u8fd9\u4e2a\u65b9\u6cd5\uff0c\u4e5f\u53ef\u80fd\u4e0d\u77e5\u9053\u3002<\/p>\n

\u50cf\u5f80\u5e38\u4e00\u6837\uff0c\u5982\u679c\u4f60\u6709\u4efb\u4f55\u95ee\u9898\u6216\u8005\u53cd\u9988\uff0c\u8bf7\u5c3d\u7ba1\u4f7f\u7528\u4e0b\u9762\u7684\u8bc4\u8bba\u6846\u6765\u7559\u4e0b\u4f60\u5b9d\u8d35\u7684\u610f\u89c1\u6216\u5efa\u8bae\uff0c\u6211\u4eec\u671f\u5f85\u7740\u60a8\u7684\u7559\u8a00\u3002<\/p>\n


\n

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

\u4f5c\u8005\uff1aGabriel C\u00e1nepa<\/a> \u8bd1\u8005\uff1aGOLinux<\/a> \u6821\u5bf9\uff1awxy<\/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-8328-1.html<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1a http:\/\/lrxjmw.cn\/linux-dbroot-password.html<\/a>\u7f16\u8f91\u5458\uff1a\u674e\u5e05\uff0c\u5ba1\u6838\u5458\uff1a\u5cb3\u6c38<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5982\u679c\u4f60\u662f\u7b2c\u4e00\u6b21\u5b89\u88c5 MySQL \u6216 MariaDB\uff0c\u4f60\u53ef\u4ee5\u6267\u884c mysql_secure_installation \u811a\u672c\u6765\u5b9e\u73b0\u57fa\u672c\u7684\u5b89\u5168\u8bbe\u7f6e\u3002<\/p>\n","protected":false},"author":63,"featured_media":57025,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-56480","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\/56480","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\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=56480"}],"version-history":[{"count":9,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/56480\/revisions"}],"predecessor-version":[{"id":276529,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/56480\/revisions\/276529"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/57025"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=56480"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=56480"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=56480"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}