mysql 错误 1045(280000) 用户“debian-sys-maint”@“localhost 使用密码“yes”拒绝访问

use*_*325 2 mysql

我编辑了 deian.cnf 修改了mysql(ubuntu服务器)的密码

须藤vi /etc/mysql/debian.cnf

我改变

用户=debian-sys-maint 密码= *

用户=debian-sys-maint

密码=我的密码

然后我尝试进入 mysql 的控制台

mysql -udebian-sys-maint -p

并输入密码“mypassword”

它报道了

mysql error 1045(280000) access denied for user 'debian-sys-maint '@' localhost using password 'yes'
Run Code Online (Sandbox Code Playgroud)

我试图删除mysql并重新安装,错误是一样的。

欢迎您的评论

Ach*_*chu 5

错误消息告诉您,您的密码错误或该帐户debian-sys-maint无法访问主机上的数据库localhost

如果您确定您的密码正确,您应该授予所有权限,如下所示:

首先以root身份登录

mysql -u root -p <password>
Run Code Online (Sandbox Code Playgroud)

然后,授予完全权限:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'your password';
Run Code Online (Sandbox Code Playgroud)

重新启动mysql,看看错误信息是否消失了。