MySQL command line password change, mysql password change

Source: Internet
Author: User

MySQL command line password change, mysql password change

To assign a password when creating a new account, use create user and includeIDENTIFIED BYClause

CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass';

To assign or change a password to an existing account, use one of the following methods:

1) Use the statement with the identified by clause of alter user:

ALTER USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass';

If you are not connected as an anonymous user, you can change your password without directly naming your account:

ALTER USER USER() IDENTIFIED BY 'mypass';

2) To change the account password from the command line, use the mysqladmin command:

mysqladmin -u user_name -h host_name password "new_password"

Lightning reference https://dev.mysql.com/doc/refman/5.6/en/alter-user.html

---------------------------------------------------------------------------------

After installing mysql, modify it for the first time.

Step 1:

Set password = PASSWORD ('your new password ');

Step 2:

Alter user 'root' @ 'localhost' password expire never;

Step 3:

Flush privileges;

After completing the three steps above, log on again and use the new password. In addition to changing the new password in red, enter the new password as is.

This method seems better. → Conversion

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.