##使用mysqladmin进行修改 mysqladmin -u username -h hostname password 'new password'; ##使用set命令进行修改 SET PASSWORD FOR 'username'@'host' =PASSWORD('new password') ##使用update命令进行修改 ##MySQL 5.7版本: UPDATE mysql.user SET authentication_string=PASSWORD('abc@123') WHERE user='root'; FLUSH PRIVILEGES; ##MySQL 5.6版本: UPDATE mysql.user SET password=PASSWORD('abc@123') WHERE user='root'; FLUSH PRIVILEGES; ## 使用GRANT+明文密码 GRANT USAGE ON *.* TO 'gga2'@'localhost' IDENTIFIED BY '123@456'; ## 使用GRANT+密文密码 SELECT PASSWORD('123@456'); GRANT USAGE ON *.* TO 'gga3'@'localhost' IDENTIFIED BY PASSWORD '*864CE19166BD4846244E41F8EA56377F18C3EFAA';