解决办法:

方法一:
1.关闭mysql
   # service mysqld stop
2.屏蔽权限
   # mysqld_safe --skip-grant-table
   屏幕出现: Starting demo from .....
3.新开起一个终端输入
   # mysql -u root mysql
   mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
   mysql> FLUSH PRIVILEGES;//记得要这句话,否则如果关闭先前的终端,又会出现原来的错误
   mysql> \q

方法二:
1.关闭mysql
   # service mysqld stop
2.屏蔽权限
   # mysqld_safe --skip-grant-table
   屏幕出现: Starting demo from .....
3.新开起一个终端输入
   # mysql -u root mysql
   mysql> delete from user where USER='';
   mysql> FLUSH PRIVILEGES;//记得要这句话,否则如果关闭先前的终端,又会出现原来的错误
   mysql> \q

转自:https://blog.csdn.net/tys1986blueboy/article/details/7056835

相关文章:

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