步骤:

  1. 关闭mysql服务
    方法一,以管理员打开cmd命令窗口,输入:net stop mysql
    方法二,服务中关闭,如图
    windons10下mysql报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

  2. 以管理员模式打开cmd,切换到MySQL安装目录的bin目录下,执行:
    windons10下mysql报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

  3. 不要关闭上面的cmd窗口,以管理员模式新开一个cmd窗口,切换到MySQL安装目录的bin目录下,执行:
    windons10下mysql报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

  4. 修改root密码,并重新加载用户权限,执行:
    windons10下mysql报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

  5. 退出mysql模式
    windons10下mysql报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

  6. 用新密码登录
    windons10下mysql报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

注意:在MySQL5.7中user表的password已换成authentication_string。
注意:在修改密码后,需要执行FLUSH PRIVILEGES语句,以重新加载用户权限。

相关文章:

  • 2022-12-23
  • 2021-06-12
  • 2021-04-16
猜你喜欢
  • 2021-12-04
  • 2021-08-01
  • 2022-02-18
  • 2021-12-25
  • 2021-07-17
  • 2021-10-25
相关资源
相似解决方案