MySQL 5.7.16 forgot root password How to change root password

Source: Internet
Author: User
Tags mysql command line

Today on the computer installed mysql5.7.16 (compressed package), after initializing the data folder, do not remember the password, DOS box does not show, no way, in order to learn how to change the password, in the Internet to find a lot of ways to solve, the final solution, the following look at the specific operation of this method:

1. Close the running MySQL service.

2. Open the DOS window and go to the Mysql\bin directory

3. Enter Mysqld--skip-grant-tables 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 and, if successful, the MySQL prompt > will appear.

6. Connection rights database: use MySQL; (Don't forget the last semicolon).

7. Change Password: Update user set Password=password ("123") where user= "root"; (Don't forget the last semicolon).

If the change password appears
**mysql Change Password error 1054 (42S22) * *

Then use Mysql>update mysql.user set Authentication_string=password (' 123456 ') where user= ' root ' and Host = ' localhost '; Through the above modification, the root password has been modified successfully, at this time if you start the MySQL service, the service should not start, my way is to start the new computer, the new start service, the MySQL service can start normally, at this time through the Navicat can be connected with a new password, or through MySQL command line to enter the database.

MySQL 5.7.16 forgot root password How to change root password

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.