using ALTER USER statement before executing this statement.


在高版本的(如Mysql 8.0)上,使用如下语句修改密码

ALTER USER 'root'@'localhost' IDENTIFIED BY 'your_new_password' PASSWORD EXPIRE NEVER;	-- 密码不过期

ALTER USER 'root'@'localhost' IDENTIFIED BY 'your_new_password' PASSWORD EXPIRE;	-- 密码有过期时间