MySQL Modify user Password method summary

Source: Internet
Author: User

First, mysqladmin-u user name-p old password password new password

1, to root add a password ab12. First in DOS into the directory MySQL bin, and then type the following command

Mysqladmin-u Root-password AB12

Note: Since Root does not have a password at the beginning, the-p old password can be omitted.

2, and then the root of the password changed to djg345.

Mysqladmin-u root-p ab12 Password djg345

(Note: Unlike the above, the following are the commands in the MySQL environment, followed by a semicolon as the command Terminator)

3, the command line to modify the root password:

mysql> UPDATE mysql.user SET password=password (' New password ') WHERE user= ' root ';

mysql> FLUSH privileges;

4, display the current user:

Mysql> SELECT USER ();

Two, UPDATE user statement (back to directory )

This must be done by logging into MySQL with the root account and then executing:

UPDATE user SET Password=password (' 123456 ') WHERE user= ' root ';

FLUSH privileges;

Three. SET PASSWORD statement (Huitian record)

This approach also requires logging into MySQL with the root command, and then executing:

SET PASSWORD for Root=password (' 123456 ');


All right, today. About the way to modify the MySQL user password is here, if you are forgetting the root password can refer to the other related articles oh.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.