28000][1045] Access denied for user 'root'@'localhost' (using password: YES)
时间: 2023-08-09 07:09:29 浏览: 103
这个错误信息 "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)" 表示用户 'root'@'localhost' 被拒绝访问,使用了密码验证。\[1\] 这个错误通常出现在尝试连接MySQL服务器时,可能有几个原因导致这个问题。
首先,可能是由于MySQL服务器停止了用户的端口号或者IP,或者是MySQL的配置文件(如my.ini)出现错误。\[2\] 您可以检查MySQL服务是否已启动,使用命令 "service mysqld status"。
其次,可能是由于root用户的密码错误。您可以尝试重新设置root用户的密码。
另外,如果您使用Navicat连接MySQL数据库时出现2059错误,您可以登录MySQL并执行以下命令来解决问题:\[3\]
```
use mysql;
ALTER USER 'root'@'%' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
FLUSH PRIVILEGES;
```
请注意,将 'password' 替换为您要设置的实际密码。
总结来说,当出现 "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)" 错误时,您可以检查MySQL服务是否已启动,确保root用户的密码正确,并尝试执行上述命令来解决问题。
#### 引用[.reference_title]
- *1* [mysql登录报错:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)](https://blog.csdn.net/m0_70556273/article/details/126490767)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [MySQL登录时ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ 完美解决](https://blog.csdn.net/l_mloveforever/article/details/111769835)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)](https://blog.csdn.net/LLL3189860667/article/details/126545183)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文