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

What are the ways that MySQL can change passwords?

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

Share

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

This article mainly explains "what methods MySQL can change the password", the content of the explanation is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "MySQL what methods can change the password" bar!

Summary of methods of modifying password by MySQL

First of all, let's make it clear that in most cases, root permission in MYSQL is required to modify Mysql.

So the average user cannot change the password unless an administrator is requested.

Method one

Using PHPmyadmin, which is the easiest, modify the user table of the mysql 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 (' biscuit'))

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 (' biscuit'))

Mysql > FLUSH PRIVILEGES

Method five

Use the SET PASSWORD statement

Mysql > SET PASSWORD FOR jeffrey@ "%" = PASSWORD ('biscuit')

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 jeffrey@ "%" IDENTIFIED BY 'biscuit'

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.

Thank you for your reading, the above is "what methods MySQL can change the password" content, after the study of this article, I believe you have a deeper understanding of what methods MySQL can change the password, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

Database

Wechat

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

12
Report