从5.7开始user表中已经没有password字段,而是将加密后的用户密码存储authentication_string字段;
select password(‘123456’);
查看加密后的编码,*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9
然后更新authentication_string字段
update mysql.user set authentication_string='*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9' where user='root' and Host = 'localhost';
正常情况下修改密码方法如下
alter user 'root'@'localhost' identified by 'root';
修改成功后,刷新权限,重新登录
flush privileges;