In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Xiaobian to share with you what MySQL ways to change the user's password, I believe that most people do not know much, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
In MySQL, you can use three different statements to change the user account password:
1 、 UPDATE
2 、 SET PASSWORD
3 、 ALTER USER
But before changing your account password, there are two very important things to keep in mind:
1. Details of the user account to change the password.
2. The user who is changing the password is using the application, because if you change the password without changing the application's connection string, the application will not be able to connect to the database server.
Now let's learn how to change a user's password in SQL using the three SQL statements mentioned above:
1. Use the SET PASSWORD declaration to change the MySQL user password:
To use the SET PASSWORD statement to change a user's password, the first requirement is that the account must have at least UPDATE privileges.
The user account should be in the format "user @ host" and you want to update its password.
To change the password of the user account "gfguser1" to "newpass" using the SET PASSWORD statement, execute the following code statement:
Syntax:
2. Use the ALTER USER statement to change the MySQL user password: the second way to change the user account password is to use the ALTER USER statement.
The ALTER USER statement is used with the "IDENTIFIED BY" clause.
To change the password of the user account "gfguser1" to "newpass" using the Alter User statement, the syntax is as follows:
Syntax:
3. Use the update statement to change the MySQL user password: the third way to change the user account password is to use the update statement.
The Update statement updates the user table of the mysql database.
The FLUSH PRIVILEGES statement needs to be executed after the UPDATE statement is executed.
The FLUSH PRIVILEGES statement is used to reload permissions from the grant table in the mysql database.
To change the password of the user account "gfguser1" to "newpass" connected from the localhost server, the syntax is as follows:
Syntax:
The above are all the contents of MySQL's method of changing the user's password. Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.