# # Root user to modify their own password # The first method: Modify the mysqladmin-u root-p password "test" through the mysqladmin command will prompt you to enter the old password after the terminal type the above command, enter the password to change to test, note that The new password should be enclosed in double quotation marks and not in single quotes, otherwise the modified password may not be the one you want. # The second method: directly modify the mysql.user table update ' MySQL '. ' User ' SET ' Password ' = Password (' test ') WHERE ' user ' = ' root ' and ' Host ' = ' Localho St '; FLUSH privileges;# You can change the new password to test by using the above statement. # The Third method: Use the SET statement to modify the set Password=password (' Test '); # The new password can be changed to test using the above statement.
# # Root user changes the password of a normal user # The first method: Use the SET statement to modify the set PASSWORD for ' test ' @ ' localhost ' = PASSWORD (' abc '); # The above statement is to set the local test user's password to ABC. # The second method: directly modify the Mysql.user table update mysql.user SET Password = Password (' abc ') WHERE user = ' Test ' and Host = ' localhost '; FLUSH privileges;# The third method: Use the GRANT statement to modify the grant SELECT on *. * to ' test ' @ ' localhost ' identified by ' ABC '; FLUSH privileges;# The above statement allows the local test user to change the password while giving its SELECT permission and specifying the scope of the permission.
# # Ordinary users modify their own password # The first method: Use the SET statement to modify the set Password=password (' abc '); # The second method: Use the mysqladmin command to modify mysqladmin-u test-p PASSWORD " ABC "# After you enter your old password, you can change the password to ABC.
This article is from the "Last Night Stars" blog, please make sure to keep this source http://yestreenstars.blog.51cto.com/1836303/1682499
MySQL Modify user password