Case study on how to use MySQL command line to change the password

Source: Internet
Author: User
Use the MySQL command line to change the password bitsCN.com

You can use the MySQL command line to modify the password of the MySQL database. The following describes the MySQL command line in detail. if you are interested, take a look.

Format: mysqladmin-u username-p old password new password

1. add a password ab12 to the root user. First, enter the mysql/bin directory under DOS, and then type the following command

Mysqladmin-u root-password ab12

Note: Because the root account does not have a password at the beginning, the old-p password can be omitted.

2. change the root password to djg345.

Mysqladmin-u root-p ab12 password djg345

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

3. change the root password through the command line:

Mysql> UPDATE mysql. user SET password = PASSWORD ('New password') WHERE User = 'root'; mysql> flush privileges;

4. display the current user:

Mysql> select user ();

The above is the use of MySQL command line to change the password _ MySQL content, for more information, please follow the PHP Chinese network (www.php1.cn )!

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.