有的时候忘记了root密码或其他用户的密码,登录的时候报错:ERROR 1044 (42000): Access denied for user ”@’localhost’ to database 'xx'。下面是具体的解决方法:

1、关闭mysql

#service mysqld  stop

2、屏蔽权限

# mysqld_safe --skip-grant-table

3、新开起一个终端输入

# mysql -u root mysql
# mysql> UPDATE user SET Password=PASSWORD('1234567') where USER='root';
# mysql> FLUSH PRIVILEGES;//记得要这句话,否则如果关闭先前的终端,又会出现原来的错误
# mysql> \q

这样就设置成功了。


相关文章:

  • 2022-01-24
  • 2022-12-23
  • 2021-08-01
猜你喜欢
  • 2021-08-01
  • 2021-07-29
  • 2021-07-25
  • 2021-08-01
  • 2021-08-01
  • 2021-12-02
相关资源
相似解决方案