一般出现这种情况,只要重新修改下root密码

解决方法:
1.打开/etc/mysql/debian.cnf文件,里面存储了系统管理员的密码

2. 输入命令:

mysql -udebian-sys-maint -p

再输入对应debian.cnf里对应的密码,以管理员身份进去

3.进入控制台后.按以下步骤进行:

解决ubuntu下mysql的'Access denied for user 'root'@'localhost' (using password: YES)'

 

 

update user set password=PASSWORD('新密码') where user='root';FLUSH PRIVILEGES;

 

如果你的mysql是5.7版本后的  

  1.  
    password字段已经改成authentication_string这个字段了,那就输入
  2.  
    update user set 
    authentication_string=PASSWORD('新密码') where user='root';

     

此时可以输入quit;退出
sudo /etc/init.d/mysql restart
重启MySQL
用root帐号登录

相关文章:

  • 2022-12-23
  • 2021-06-22
  • 2021-07-22
  • 2021-07-31
  • 2021-04-29
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
猜你喜欢
  • 2022-12-23
  • 2021-09-11
  • 2021-07-03
相关资源
相似解决方案