The first thing to declare is that in most cases, MySQL is required to have root privileges in MySQL,
Therefore, the general user cannot change the password unless the administrator is requested.
Method One
Using phpMyAdmin, this is the easiest, to modify the MySQL library's user table,
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 for root, and then the root password will be changed to MYPASSWD.
Change the command root to your username, and you can change your password.
Of course, if your mysqladmin is not connected to MySQL server, or you have no way to execute mysqladmin,
Then this method is ineffective.
And mysqladmin can't empty the password.
The following methods are used at the MySQL prompt and must have the root permissions of MySQL:
Method Three
Mysql> INSERT into Mysql.user (Host,user,password)
VALUES ('% ', ' Jeffrey ', PASSWORD (' biscuit '));
Mysql> FLUSH Privileges
To be exact, this is adding a user, the username is Jeffrey, and the password is biscuit.
There is this example in the MySQL Chinese reference manual, so I wrote it.
Note that you want to use the password function, and then use flush privileges.
Method Four
And method Three, just use the Replace statement
Mysql> REPLACE into Mysql.user (Host,user,password)
VALUES ('% ', ' Jeffrey ', PASSWORD (' biscuit '));
Mysql> FLUSH Privileges
Method Five
Using the Set Password statement,
Mysql> SET PASSWORD for jeffrey@ "%" = PASSWORD (' biscuit ');
The password () function must also be used,
But you don't need to use flush privileges.
Method Six
Use Grant ... Identified by statement
Mysql> GRANT USAGE on *.* to jeffrey@ "%" identified by ' biscuit ';
Here the password () function is unnecessary and does not require the use of flush privileges.
Note: PASSWORD () [is not] the password encryption is performed in the same way as the UNIX password encryption.
MySQL Forgot Password Solution
If MySQL is running, first kill: Killall-term mysqld.
Start Mysql:bin/safe_mysqld--skip-grant-tables &
You can enter MySQL without the need for a password.
Then it's
>use MySQL
>update User Set Password=password ("New_pass") where user= "root";
>flush privileges;
Re-kill MySQL, the normal way to start MySQL.
Note: Use phpMyAdmin to modify the password must use the encryption method, otherwise the modification can not enter the phpmyadmin!
We recommend that you modify your password using the command line
After entering MySQL
Mysql>update Mysql.user Set Password=password (' New password ');
Mysql>flush privileges;
If the use of phpMyAdmin modified password can not login phpMyAdmin, the simplest way is to reinstall the phpMyAdmin, simply delete the original phpMyAdmin folder, the phpMyAdmin will be compressed to decompress the package, This method for me in the change password can not login, want to do a variety of methods after the idea of the best, hehe ...