【已解决】The specified database user/password combination is rejected: [28000][1045] Access denied

问题描述

在使用IDEA连接数据库时报错

The specified database user/password combination is rejected: [28000][1045] 
Access denied for user 'yunjuan_xie'@'localhost' (using password: YES

说指定的数据库用户/密码组合被拒绝
而我输入的用户密码是正确的,使用它连接navicat都是成功的(安装mysql时设置的用户和密码)
在这里插入图片描述
但是连接IDEA报错
在这里插入图片描述

解决办法

从网上查询到主要有以下两种解决办法
1.MySQL服务未启动
左下角搜索打开服务,找到mysql服务看是否打开
在这里插入图片描述
我的是打开的
2.MySQL 的端口号被占用
如果有多个mysql服务启动了,需要停止多余的服务,我的(按上图)并没有
在这里插入图片描述
这两种解决办法经我尝试都是行不通的
我只好再次验证我这个mysql密码对不对
进入mysql安装的bin目录下cmd进入控制台,输入

mysql -u root -p

输入密码连接是成功的!

在这里插入图片描述
现在算是卡在这里了。。。
后面我尝试把用户换成root再输入这个密码竟然就连通了!!
在这里插入图片描述
不知原因,不过还是记住吧。。要使用root
注:yml文件这里使用的不是root
在这里插入图片描述

  • 13
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
The error message "The specified database user/password combination is rejected: [28000][1045] Access denied for user 'root'@'localhost' (using password: NO)" indicates that the specified user 'root' with the provided password is being denied access to the database. This can happen if the password is incorrect or if the user does not have the necessary privileges to access the database. To resolve this issue, you can try the following steps: 1. Double-check the password: Make sure you are using the correct password for the 'root' user. Remember that passwords are case-sensitive, so ensure that you are entering the password exactly as it is. 2. Grant necessary privileges: If the 'root' user does not have the necessary privileges to access the database, you can grant them by logging in to the database with a user that has administrative privileges and running the following command: ``` GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES; ``` 3. Reset the password: If you're still unable to access the database, you can try resetting the password for the 'root' user. This can be done by following these steps: - Stop the MySQL server. - Start the MySQL server with the `--skip-grant-tables` option, which allows you to connect to the server without a password. - Connect to the MySQL server and switch to the 'mysql' database. - Update the password for the 'root' user using the following command: ``` UPDATE user SET authentication_string=PASSWORD('new_password') WHERE User='root'; ``` Replace 'new_password' with the desired password. - Flush the privileges and restart the MySQL server. After trying these steps, you should be able to access the database with the 'root' user. If you continue to experience issues, please provide more information about your setup and configuration so that I can assist you further.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

李莲花*

多谢多谢,来自一名大学生的感谢

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值