MySql5.6 Version change user login password

Source: Internet
Author: User

1. UPDATE User statement (This is the method I use)

This must be done first by logging in to MySQL with the root account and then executing:

 mysql> UPDATE user SET Password = Password (' new password ') WHERE user = ' root ';
mysql> FLUSH privileges;

when you forget the root password, you can
take windows as an example:
1. Close the running MySQL service
2. Open the DOS window and go to the Mysql\bin directory
3. Enter Mysqld--skip-grant-tables carriage return. --skip-grant-tables means skipping permission table authentication when starting the MySQL service
4. Open a DOS window again (because the DOS window is no longer moving), go to the Mysql\bin directory
5. Enter MySQL return, if successful, a MySQL prompt will appear >
6. Connection rights database: use MySQL
7. Change Password: Update user set Password=password ("123456") where user= "root"; (don't forget the last semicolon!!!!! Have eaten a loss ... )
8. Refresh permissions (required steps): flush privileges; (with semicolons)
9. Quit quit.
10. Restart MySQL, enter the password to login!

2.SET PASSWORD Statement

This way you need to log in to MySQL with the root command and then execute:

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

 

MySql5.6 Version change user login password

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.