使用mysqladmin
mysql\bin>mysqladmin -u user -p password "newpassword"(有原始密码)
mysql\bin>mysqladmin -u user password "newpassword"(原始密码为空)
使用语句SET PASSWORD
mysql> SET PASSWORD = PASSWORD('another pass');(当前用户)
mysql> SET PASSWORD FOR bob@"%.loc.gov" = PASSWORD("newpass");(指定用户)
mysql\bin>mysqladmin -u user -p password "newpassword"(有原始密码)
mysql\bin>mysqladmin -u user password "newpassword"(原始密码为空)
使用语句SET PASSWORD
mysql> SET PASSWORD = PASSWORD('another pass');(当前用户)
mysql> SET PASSWORD FOR bob@"%.loc.gov" = PASSWORD("newpass");(指定用户)