{"id":100983,"date":"2024-07-25T02:50:11","date_gmt":"2024-07-24T18:50:11","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=100983"},"modified":"2024-07-25T02:50:11","modified_gmt":"2024-07-24T18:50:11","slug":"mariadb-root-password","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/mariadb-root-password.html","title":{"rendered":"\u4fee\u6539\u3001\u7834\u89e3 MariaDB\u6570\u636e\u5e93 root \u5bc6\u7801"},"content":{"rendered":"
<\/p>\n
\u4fee\u6539mysql\u5bc6\u7801\u6709\u591a\u79cd\u65b9\u6848\u4e0b\u9762\u4ecb\u7ecd2\u4e2a<\/p>\n
\r\n # \/usr\/local\/mysql\/bin\/mysqladmin -uroot -p password \"New-password\"\r\n Enter password: \u3010\u8f93\u5165\u539f\u6709\u5bc6\u7801\u3011 \/\/\u8f93\u5165\u540e\u56de\u8f66\u5bc6\u7801\u5c31\u4fee\u6539\u6210\u4e86New-password\r\n<\/pre>\n\u65b9\u6848\u4e8c<\/strong><\/span><\/div>\n\r\n # mysql -uroot -p \/\/\u56de\u8f66\u767b\u5f55mysql\u7cfb\u7edf\r\n Enter password: \u3010\u8f93\u5165\u539f\u6765\u7684\u5bc6\u7801\u3011\r\n MariaDB [(none)]> use mysql\uff1b \/\/\u8fdb\u5165mysql\u6570\u636e\u5e93\r\n MariaDB [(none)]> update user set password=passworD(\"New-password\") where user='root';\r\n MariaDB [(none)]> flush privileges; \/\/\u5237\u65b0\u6570\u636e\u5e93\r\n MariaDB [(none)]> exit; \/\/\u9000\u51fa\r\n<\/pre>\n\u4fee\u6539\u5b8c\u6210\uff01<\/p>\n
\u5982\u679c\u4f60\u4e0d\u8bb0\u5f97\u4e4b\u524d\u7684\u8001\u5bc6\u7801\uff0c\u90a3\u4e48\u53ea\u80fd\u5c1d\u8bd5\u7834\u89e3\uff0c\u7834\u89e3\u65b9\u6848\u4ee5\u4e0b\uff1a<\/p>\n
\u524d\u7f6e\u6761\u4ef6\uff1a\u5fc5\u987b\u62e5\u6709\u670d\u52a1\u5668\u6700\u9ad8\u7ba1\u7406\u5458\uff08root\uff09\u6743\u9650\u3002<\/p>\n
\r\n # systemctl stop mysql\r\n # \/usr\/local\/mysql\/bin\/mysqld_safe --skip-grant-tables &\r\n<\/pre>\n\u201c&\u201d \u8868\u793a\u5728\u540e\u53f0\u8fd0\u884c\uff0c\u82e5\u4e0d\u518d\u540e\u53f0\u8fd0\u884c\uff0c\u5c31\u518d\u6253\u5f00\u4e00\u4e2a\u7ec8\u7aef\u3002<\/p>\n
\r\n# mysql\r\n MariaDB [(none)]> use mysql;\r\n MariaDB [(none)]> UPDATE user SET password=password(\"New-password\") WHERE user='root';\r\n MariaDB [(none)]> flush privileges;\r\n MariaDB [(none)]> exit;\r\n<\/pre>\n\u7834\u89e3\u5b8c\u6210\uff01<\/p>\n
\n\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/renwole.com\/archives\/57<\/a><\/p>\n