[Ubuntu] Access denied for user ‘debian-sys-maint’@'localhost’ (using password: YES)

I have reinstalled my system to Ubuntu 12.04, after installed mysql, i found that there is an error when start mysql: 

Access denied  for user ‘debian-sys-maint’@'localhost’ (using password: YES) 

 

After searching the reason via google, i at last found the reason, here is it:

That’s because debian has a mysql account  for switching on/off and checking mysql status, and mysql password  for that user “debian-sys-maint” should be the same stored  in /etc/mysql/debian.cnf

 

here is the way to resolve it.

1. check the password in /etc/mysql/debian.cnf

sudo vim /etc/mysql/debian.cnf

you will see something like these:

[client]
host     = localhost
user     = debian-sys-maint
password = your-password-here
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host     = localhost
user     = debian-sys-maint
password = your-password-here
socket   = /var/run/mysqld/mysqld.sock
basedir  = /usr 

 

2. login to mysql:

mysql -u root -p

 

3. grant the rights to debian-sys-maint

mysql> GRANT ALL PRIVILEGES ON *.* TO ‘debian-sys-maint’@'localhost’ IDENTIFIED BY ‘your-password-here’ WITH GRANT OPTION;

 

Query OK, 0 rows affected (0.00 sec) 

 

Done! 

 

 

转载于:https://www.cnblogs.com/davidhhuan/archive/2012/05/19/2508692.html

这个错误是由于用户'debian-sys-maint'在登录MySQL时密码不正确所引起的。根据引用和引用的信息,这可能是由于遭到攻击导致root用户被删除,或者是密码突然失效。为了解决这个问题,可以按照以下步骤进行操作: 1. 首先,可以尝试使用引用中提到的方法,修改MySQL的配置文件以跳过权限验证,从而允许无密码登录。具体操作是使用命令sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf打开配置文件,并在文件中添加skip-grant-tables这一行。然后保存并退出配置文件。 2. 接下来,重新启动MySQL服务,以使新的配置生效。可以使用命令sudo service mysql restart来重启MySQL服务。 3. 在重新启动MySQL服务后,尝试以root身份登录MySQL,使用命令mysql -u root进入MySQL控制台。 4. 一旦成功登录MySQL控制台,可以使用命令ALTER USER 'debian-sys-maint'@'localhost' IDENTIFIED BY 'new_password';来修改'debian-sys-maint'用户的密码。将'new_password'替换为你想要设置的新密码。 5. 修改完密码后,再次编辑MySQL的配置文件,将之前添加的skip-grant-tables这一行删除。保存并退出配置文件。 6. 最后,重新启动MySQL服务,让修改后的配置生效。 通过以上步骤,应该能够解决ERROR 1045 (28000): Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)的问题。记得在修改密码时选择一个强密码以确保系统的安全性。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Ubuntu mysql 修改密码失败的问题ERROR 1045 (28000): Access denied for userdebian-sys-maint‘@...](https://blog.csdn.net/weixin_42716139/article/details/124453655)[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^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [ERROR 1045 (28000): Access denied for userdebian-sys-maint‘@‘localhost数据库忘记密码修改,...](https://blog.csdn.net/qq_43575423/article/details/130764636)[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^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值