MySQL database forgot root password, how to modify

Source: Internet
Author: User

MySQL database forgot root password is a very painful thing, even if you uninstall the database reinstall, password still can not reset, today this thing makes me extremely headache, finally, found a solution.

The actual operation under Windows is as follows:

1. Close the running MySQL database.

2. Open the DOS window and go to the bin file under the MySQL installation directory. such as:C:\Program files\mysql\bin

3. DOS continues Enter Mysqld--skip-grant-tables, and then enter in Safe mode. If the message doesn't appear, it's right.

4. Now reopen a DOS window, go to the MySQL installation directory under the bin file. Enter Mysql-uroot-p, then prompt for the password, do not enter, directly enter.

5. Enter Update Mysql.user set Password=password (' NewPassword ') where user= ' root '; the newpassword here is the new password to be set, and the following number is required.

6, Refresh the permissions table input flush privileges;

7, Exit DOS.

8. Restart the MySQL service.

A. Open the Task Manager and end the Mysql-nt.exe process.

B. Restart MySQL service.



This time the password has been modified successfully, you can log into the database with the new password.


MySQL database forgot root password, how to modify

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.