Get the App
SLTechnology News&Howtos  ›  Database  › 

How to change password in MySQL database

Shulou Source: shulou.com Published: 2022-05-31 18:58:15 09月18日 Update

Today, I will talk to you about how to change the password in the MySQL database, many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

What are the measures for MySQL database to modify MySQL password

Step 1: use phpmyadmin, which is the easiest, modify the user table of the mysql library, but don't forget to use the PASSWORD function.

Measure 2: use mysqladmin, which is a special case stated earlier. After mysqladmin-uroot-ppasswordmypasswd enters this call, you must enter the original password of root, and then the password of root will be changed to mypasswd. Change the root in the call to your user name, and you can change your own password. Of course, in case your mysqladmin is not connected to mysqlserver, maybe you have not taken measures to enforce mysqladmin, then this measure is ineffective. And mysqladmin can't clear the password.

Note: the following measures are used under the mysql reminder, and you must have root permission for mysqlkcitrust.com:

Measure 3:

Mysql > INSERTINTOmysql.user (Host,User,Password) VALUES ('%', 'jeffrey',PASSWORD (' biscuit')); mysql > FLUSHPRIVILEGES

To be exact, this is an addition of a user with the user name jeffrey and the password biscuit. There is this example in the mysql Chinese reference Manual, so I wrote it out. Be careful to take advantage of the PASSWORD function, and then use FLUSHPRIVILEGES.

What are the measures for MySQL database to modify MySQL password

Measure 4: like measure 3, except for the use of REPLACE statements

Mysql > REPLACEINTOmysql.user (Host,User,Password) VALUES ('%', 'jeffrey',PASSWORD (' biscuit')); mysql > FLUSHPRIVILEGES

Measure 5: use SETPASSWORD statement

Mysql > SETPASSWORDFORjeffrey@ "%" = PASSWORD ('biscuit')

You must also use the PASSWORD () function, but you don't have to use FLUSHPRIVILEGES.

Measure 6: use GRANT.IDENTIFIEDBY statement

Mysql > GRANTUSAGEON*.*TOjeffrey@'% 'IDENTIFIEDBY'biscuit'

Here the PASSWORD () function is unnecessary, and there is no need to make use of FLUSHPRIVILEGES.

Beware: PASSWORD () does not enforce password encryption in the same way that Unix passwords are encrypted.

After reading the above, do you have any further understanding of how to change the password in the MySQL database? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Tags: Measures password data database function content user statement password this is encryption input example just manual is in more permissions special cases user name Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia MySQL Microsoft OPPO Reno Redmi