MySQL uses the set password command to change the user PASSWORD. The basic usage is as follows.
Set password = PASSWORD ('Some password ')
Set password for user = PASSWORD ('Some password ')
The first command is to modify the password of the current user, and the second command is to modify the password of the specified user. It is important to use the PASSWORD function to encrypt the specified PASSWORD and save it to the database.
The simplest way to change the password is:
1. Log on to mysql with root: mysql-u root-p root password, and go to mysql> status;
2. mysql> UPDATE user SET password = PASSWORD ('New password') WHERE user = 'created common username ';
3. mysql> grant select on the name of the database to be authorized. * to 'normal username '@' % ';
4. mysql> flush privileges;
Enter the following command.
Set password for 'username' @ 'localhost' = PASSWORD ('pass ');
Set the password of 'Username' @ 'localhost' to pass. Note that the specified format of the user name is user name @ host name.