Example of changing a user's PASSWORD (set password) in MySQL

Source: Internet
Author: User

MySQL uses the set password command to change the user PASSWORD. The basic usage is as follows.

Set password = PASSWORD ('Some password ')
Set password for user = PASSWORD ('Some password ')

The first command is to modify the password of the current user, and the second command is to modify the password of the specified user. It is important to use the PASSWORD function to encrypt the specified PASSWORD and save it to the database.

The simplest way to change the password is:

1. Log on to mysql with root: mysql-u root-p root password, and go to mysql> status;

2. mysql> UPDATE user SET password = PASSWORD ('New password') WHERE user = 'created common username ';

3. mysql> grant select on the name of the database to be authorized. * to 'normal username '@' % ';

4. mysql> flush privileges;

Enter the following command.

Set password for 'username' @ 'localhost' = PASSWORD ('pass ');

Set the password of 'Username' @ 'localhost' to pass. Note that the specified format of the user name is user name @ host name.

Related Article

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.