Guidance:In most cases, modifyMySQL Database PasswordThe root permission in mysql is required. Therefore, you cannot change the password unless you request the Administrator. I have summarized several methods below, hoping to help you.
Method 1
Phpmyadmin is the simplest. Modify the user table of the mysql database,
But don't forget to use the PASSWORD function.
Method 2
Use mysqladmin, which is a special case stated above.
Reference content is as follows:
Mysqladmin-u root-p password mypasswd
After entering this command, you need to enter the original root password, and then the root password will be changed to mypasswd.
Change the root in the command to your username, and you can change your password.
Of course, if your mysqladmin cannot connect to mysql server, or you cannot execute mysqladmin,
This method is invalid. In addition, mysqladmin cannot clear the password.
The following methods are used at the mysql prompt and must have the root permission of mysql:
Method 3
Reference content is as follows:
Mysql> insert into mysql. user (Host, User, Password)
VALUES (\ %, jeffrey, PASSWORD
Mysql> FLUSH PRIVILEGES
Specifically, this is adding a user with the username jeffrey and password biscuit. I wrote this example in mysql Chinese reference manual. Be sure to use the PASSWORD function, and then use flush privileges.
Method 4
Similar to method Sany, but the REPLACE statement is used.
Reference content is as follows:
Mysql> replace into mysql. user (Host, User, Password)
VALUES (\ %, jeffrey, PASSWORD
Mysql> FLUSH PRIVILEGES
Method 5
Use the set password statement,
Mysql> set password for jeffrey @ "%" = PASSWORD
You must also use the PASSWORD () function,
However, you do not need to use flush privileges.
Method 6
Use the GRANT... identified by statement
Mysql> grant usage on *. * TO jeffrey @ "%" IDENTIFIED
Here, the PASSWORD () function is unnecessary and does not need to be flush privileges.
Note: PASSWORD () [not] implements PASSWORD encryption in the same way as Unix PASSWORD encryption.
Here we will summarize these six methods. If you have more and better methods, please share them with us.