'用户'root'@'localhost'的访问被拒绝(使用密码:NO)'

2021-11-20 00:00:00 mysql

我正在尝试设置用户 root 的密码,但出现以下错误,知道吗?

I'm trying to set the password of the user root but I'm gettin the error below, any idea?

+----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost                                                                                                              |
+----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*436576511F70A4E3B305E1AB8E209851945D8687' WITH GRANT OPTION |
+----------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)


mysql> exit
Bye
root@tirengarfio:/var/www/rs2# mysqladmin -u root password foo,
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'

推荐答案

$ mysqladmin -u root -p password
Enter password: 
New password: 
Confirm new password:

password 应按字面输入.这是一个命令.您不必将 password 替换为您的实际密码.

password is to be typed literally. It's a command. You don't have to substitute password with your actual password.

相关文章