$ mysql -u root -p
$ use mysql;
$ mysql > update user set password=password('new password') where user = 'root';
$ mysql > update user set authentication_string=password('new password') where user = 'root';
$ mysql > alter user 'root'@'localhost' identified with mysql_native_password by 'new password';
$ mysql > flush privileges;