First, in most cases, modifying mysql is required to have root permissions in MySQL, so general users cannot change the password unless the administrator is requested.
method one
Using phpMyadmin, this is the easiest, modify the User table of the MySQL library.
But don't forget to use the Password function.
Method Two
Using mysqladmin, this is a special case of the previous declaration.
mysqladmin -u root -p password mypasswd
After entering this command, you need to enter the original password of the root, then the root's password will change to mypasswd.
Change the root in the command to your username, you can change your own password.
Of course, if your mysqladmin is connected to MySQL Server, or you have no way to execute mysqladmin.
Then this way is invalid.
And mysqladmin cannot empty your password.
The following method is used under the MySQL prompt, and must have mysql root privileges:
Method three
Mysql> Insert Into MySQL.user (Host, User, Password)
Values (/%, Jeffrey, Password (ISCUIT);
Mysql> Flush Privileges
Specifically, this is increasing a user, the username is Jeffrey, the password is Biscuit.
There is this example in the "MySQL Chinese Reference Manual", so I will write it.
Note To use the Password function, then use Flush Privileges.
Method 4
Same three, just use the REPLACE statement
Mysql> Replace Into MySQL.user (Host, User, Password)
Values (/%, Jeffrey, Password (ISCUIT);
Mysql> Flush Privileges
Method 5
Use the Set Password statement,
MySQL> Set Password for Jeffrey @ "%" = password (iSCuit);
You must also use the Password () function,
But don't need to use flush privileges.
Method 6
Use a grant ... identified by statement
Mysql> grant usage on *. * to jeffrey @ "%" identified by iScuit;
The password () function here is unnecessary, nor does it require Flush Privileges.
Note: Password () [is not] The password encryption is applied to the same method encrypted at UNIX password.
From: Yibo Network