{"rsdb":{"rid":"156643","subhead":"","postdate":"0","aid":"117566","fid":"57","uid":"1","topic":"1","content":"

\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6211\u5f88\u81ea\u7136\u7684\u4f7f\u7528mysql\u547d\u4ee4\u767b\u9646\uff0c\u56e0\u4e3a\u662f\u521a\u5b89\u88c5\u7684\u521d\u59cb\u73af\u5883\uff0c\u7ed3\u679c\u62a5\u9519\u4e86:<\/p>

[root@node ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)<\/p>

\u7b2c\u4e00\u6b21\u78b0\u5230\u8fd9\u79cd\u60c5\u51b5\u3002\u6211\u68c0\u67e5\u4e86\u914d\u7f6e\u6587\u4ef6\uff0c\u6ca1\u53d1\u73b0\u5f02\u5e38\uff0c\u53e6\u5916yum\u5b89\u88c5,\u4e5f\u662f\u521d\u59cb\u73af\u5883\uff0c\u5e94\u8be5\u4e0d\u4f1a\u6709\u95ee\u9898\u3002\u65e0\u5948\u53ea\u80fd\u4e0a\u7f51\u627e\u627e\u76f8\u5173\u7684\u6848\u4f8b\u8bd5\u8bd5\u3002<\/p>

\u8fd8\u597d\uff0c\u6700\u540e\u6210\u529f\u7684\u89e3\u51b3\u4e86\u6b64\u95ee\u9898\u3002<\/p>

\u89e3\u51b3\u6b65\u9aa4\u5982\u4e0b:<\/p>

1,\u9996\u5148\u505c\u6389\u6570\u636e\u5e93\u670d\u52a1:<\/p>

[root@node ~]# systemctl stop mariadb.service<\/p>

2,\u4f7f\u7528mysqld_safe\u6765\u542f\u52a8mysqld\u670d\u52a1\u5668:<\/p>

[root@node ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 4120
[root@node ~]# 170301 11:04:57 mysqld_safe Logging to '\/var\/log\/mariadb\/mariadb.log'.
170301 11:04:57 mysqld_safe Starting mysqld daemon with databases from \/var\/lib\/mysql<\/p>

3,\u767b\u5f55:<\/p>

4,\u4fee\u6539root\u7528\u6237\u5bc6\u7801:<\/p>

MariaDB [mysql]> UPDATE user SET PASSWORD=PASSWORD('newpassword') where USER='root';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4? Changed: 4? Warnings: 0
?
MariaDB [mysql]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
?
MariaDB [mysql]> QUIT
Bye
[root@node ~]#<\/p>

5,\u4f7f\u7528\u4fee\u6539\u540e\u7684root\u7528\u6237\u548c\u65b0\u5bc6\u7801newpassword\u767b\u5f55\u6570\u636e\u5e93:<\/p>

[root@node ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor.? Commands end with ; or \\g.
Your MariaDB connection id is 6
Server version: 5.5.52-MariaDB MariaDB Server
?
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
?
Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.
?
MariaDB [(none)]><\/p>

\u5230\u6b64\uff0c\u8be5\u95ee\u9898\u6210\u529f\u89e3\u51b3\uff01<\/p>","orderid":"0","title":"MariaDB\u521d\u59cb\u767b\u9646\u62a5\u9519 ERROR 1045 (28000) \u7684\u89e3\u51b3\u529e\u6cd5","smalltitle":"","mid":"0","fname":"\u6570\u636e\u5e93\u7f16\u7a0b","special_id":"0","bak_id":"0","info":"0","hits":"347","pages":"1","comments":"0","posttime":"2017-03-03 08:15:35","list":"1488500135","username":"admin","author":"","copyfrom":"","copyfromurl":"","titlecolor":"","fonttype":"0","titleicon":"0","picurl":"https:\/\/www.cppentry.com\/upload_files\/","ispic":"0","yz":"1","yzer":"","yztime":"0","levels":"0","levelstime":"0","keywords":"MariaDB<\/A> \u521d\u59cb<\/A> \u767b\u9646<\/A> ERROR<\/A> 1045<\/A> 28000<\/A> \u89e3\u51b3<\/A> \u529e\u6cd5<\/A>","jumpurl":"","iframeurl":"","style":"","template":"a:3:{s:4:\"head\";s:0:\"\";s:4:\"foot\";s:0:\"\";s:8:\"bencandy\";s:0:\"\";}","target":"0","ip":"14.17.22.31","lastfid":"0","money":"0","buyuser":"","passwd":"","allowdown":"","allowview":"","editer":"","edittime":"0","begintime":"0","endtime":"0","description":"MariaDB\u521d\u59cb\u767b\u9646\u62a5\u9519 ERROR 1045 (28000) \u7684\u89e3\u51b3\u529e\u6cd5","lastview":"1713606449","digg_num":"6414","digg_time":"0","forbidcomment":"0","ifvote":"0","heart":"","htmlname":"","city_id":"0"},"page":"1"}