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;