解决Linux(CentOS) MySQL修改密码:ERROR 1133 (42000): Can't find any matching row in the user table

set password for root@localhost=password('你的密码'); 
或者
set password for 'root'@'localhost'=password('MyNewPass4!');
提示:命令修改mysql数据库root用户密码提示ERROR 1133 (42000): Can't find any matching row in the user table错误
解决:
use mysql;
select Host,User from user;

原因:主要原因是修改密码的条件不否

  • set password for 'root'@'localhost'=password('MyNewPass4!'); 代码中的localhost修改%,与数据库Host字段值一致
    set password for 'root'@'%'=password('MyNewPass4!');
  • 刷新
    flush privileges;

  •  

     

posted @ 2019-08-09 10:10  Java-Legend  阅读(16439)  评论(1编辑  收藏  举报