1、use mysql;
2、(无password字段的版本)update user set authentication_string=PASSWORD("密码") where user='root';
(有password字段的版本)update user set password=password('密码') where user='root';
3、update user set plugin="mysql_native_password";
4、flush privileges;
5、quit;
6、重启mysql服务