Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to change password for MySQL user

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article focuses on "how to change passwords for MySQL users". Friends who are interested may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor learn how to change passwords for MySQL users.

First of all, let's make it clear that in most cases, modifying MySQL requires root permission in mysql, so the average user cannot change his password unless he or she requests an administrator.

Method one

Using myadmin, this is the easiest way to modify the user table of the 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 root, and then the password of root will be changed to mypasswd.

Change the root in the command to your user name, and you can change your own password.

Of course, if your mysqladmin can't connect to mysql server, or if you can't execute mysqladmin,

Then this method is ineffective.

And mysqladmin can't clear the password.

The following methods are used at the mysql prompt and must have root permission for mysql:

Method three

Mysql > INSERT INTO mysql.user (Host,User,Password)

VALUES (\%, jeffrey,PASSWORD (iscuit))

Mysql > FLUSH PRIVILEGES

To be exact, this is adding 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.

Note that you use the PASSWORD function, and then you use FLUSH PRIVILEGES.

Method 4

Same as method 3, except that the REPLACE statement is used

Mysql > REPLACE INTO mysql.user (Host,User,Password)

VALUES (\%, jeffrey,PASSWORD (iscuit))

Mysql > FLUSH PRIVILEGES

Method five

Use the SET PASSWORD statement

Mysql > SET PASSWORD FOR "= PASSWORD (iscuit)

You must also use the PASSWORD () function

But you don't need to use FLUSH PRIVILEGES.

Method 6

Use GRANT... IDENTIFIED BY statement

Mysql > GRANT USAGE ON *. * TO "IDENTIFIED BY iscuit

The PASSWORD () function is unnecessary here, and you don't need to use FLUSH PRIVILEGES.

Note: PASSWORD () [not] performs password encryption in the same way that Unix passwords are encrypted.

At this point, I believe you have a deeper understanding of "how MySQL users change their passwords". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report