set password for 用户名@localhost = password('新密码');
or
use mysql;
update user set password=password('123') where user='root' and host='localhost';
flush privileges;
set password for 用户名@localhost = password('新密码');
or
use mysql;
update user set password=password('123') where user='root' and host='localhost';
flush privileges;