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

Summary of methods of changing password in MySQL Database (to be transferred)

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

Share

Shulou(Shulou.com)06/01 Report--

Summary of methods for modifying passwords in MySQL database [@ more@] first of all, it is stated that in most cases, modifying MySQL requires root permission in mysql, so ordinary users cannot change their passwords unless they request an administrator.

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 (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 jeffrey@ "%" = 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 jeffrey@ "%" 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.

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