5.7之前
mysql> UPDATE user SET password=PASSWORD("new password") WHERE user='username';
5.7
mysql> UPDATE user SET authentication_string=PASSWORD("new_password") WHERE user='root';
//刷新系统权限表
mysql> FLUSH PRIVILEGES;
mysql> UPDATE user SET password=PASSWORD("new password") WHERE user='username';
mysql> UPDATE user SET authentication_string=PASSWORD("new_password") WHERE user='root';
//刷新系统权限表
mysql> FLUSH PRIVILEGES;