Home  >  Article  >  Backend Development  >  Summary of MySQL password modification methods_PHP tutorial

Summary of MySQL password modification methods_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:53:39759browse

Method 1
Use phpmyadmin, this is the simplest, modify the user table of the mysql library,
But don’t forget to use the PASSWORD function.

Method 2
Use mysqladmin, which is a special case stated earlier.
mysqladmin -u root -p password mypasswd
After entering this command, you need to enter the original password of root, and then the root password will be changed to mypasswd.
Change root in the command to your username, and you can change your own password.
Of course, if your mysqladmin cannot connect to the mysql server, or you cannot execute mysqladmin,
then this method is invalid.
And mysqladmin cannot clear the password.

The following methods are used at the mysql prompt and must have mysql root permissions:
Method 3
mysql> INSERT INTO mysql.user (Host,User,Password)
VALUES('%','jeffrey',PASSWORD('biscuit'));
mysql> FLUSH PRIVILEGES
To be exact, this is adding a user with the username jeffrey and the password biscuit.
There is this example in the "mysql Chinese Reference Manual", so I wrote it out.
Note to use the PASSWORD function, and then use FLUSH PRIVILEGES.

Method 4
Same as method 3, just using the REPLACE statement
mysql> REPLACE INTO mysql.user (Host,User,Password)
VALUES('%','jeffrey ',PASSWORD('biscuit'));
mysql> FLUSH PRIVILEGES

Method 5
Use the SET PASSWORD statement,
mysql> SET PASSWORD FOR jeffrey@"%" = PASSWORD(' biscuit');
You must also use the PASSWORD() function,
but there is no need to use FLUSH PRIVILEGES.


Method 6
Use GRANT ... IDENTIFIED BY statement
mysql> GRANT USAGE ON *.* TO jeffrey@"%" IDENTIFIED BY 'biscuit';
PASSWORD here () function is unnecessary, and there is no need to use FLUSH PRIVILEGES.


Note: PASSWORD() [does not] perform password encryption in the same way as Unix password encryption.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/318630.htmlTechArticleMethod 1 uses phpmyadmin. This is the simplest. Modify the user table of the mysql library, but don’t forget to use PASSWORD function. Method 2 uses mysqladmin, which is a special case declared earlier. ...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn