MySQL Root password forgotten solution (Windows environment)

Source: Internet
Author: User

The password is many, sometimes even oneself forgot. This article is a solution to the Windows environment, forget the MySQL database root password.

1. First check that the MySQL service is started and stop the service if it is started. Available in the cmd window, using the command: net stop MySQL

2. In the cmd window, switch to the bin directory of the MySQL installation directory and run the command:

Mysqld--defaults-file= "D:\app\MySQL\MySQLServer5.5\my.ini"--console--skip-grant-tables

Upstream command explanation: through the security check, the MySQL service is turned on, so when you connect MySQL, you can not enter the user password.

3. Open another CMD window to connect to MySQL. Use the command:

Input command:mysql-uroot-p
Window display: Enter Password:
Enter directly here without entering the password. When you enter, you will be able to log in successfully.

4. After successful login, use the following command to reset the root password:

Switch database command: use MySQL;
Reset root New password: UPDATE user SET Password=password ('newpassword') where user= ' root ';
Refresh permissions: Flush privileges;
Quit Login: Quit
Re-login: mysql-uroot-p
Enter Password: Enter Password:newpassword

MySQL Root password forgotten solution (Windows environment)

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.