8.0以前
set password for root@localhost = password('123456');
//另一种方式
use mysql;
update user set password = password('123456') where user='root';
8.0以后
alter user 'root'@'localhost' identified with mysql_native_password by '123456';
flush privileges;