64-bit windows10, MYSQL8.0.13 reset password (forgot password or unable to log in)

created at 09-17-2021 views: 4

After many trials, the steps to reset the password are as follows

step1. Open the command window cmd, enter the command: net stop mysql, stop the MySQL service,

step2. Turn on the MySQL service that skips password authentication login

input the command  

mysqld --console --skip-grant-tables --shared-memory

step3. Open a new cmd, log in to MySQL without a password, and enter the login command: mysql -u root -p

step4. Leave the password blank, the command is as follows:

use mysql
update user set authentication_string='' where user='root';

step5. Exit mysql and execute the command:

quit

step6. Shut down the MySQL service started with -console --skip-grant-tables --shared-memory,

step7. Open the command box and enter: net start mysql to start the MySQL service.

step8. The password in step 4 has been left blank, so log in to MySQL without a password, and enter the login command: mysql -u root -p

step9. Use the password change command in the previous blog to successfully change the password, as shown below:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpasswd';

new password

step10. After verifying that the password is correct, log in

Enter quit, exit the current login, enter the login command: mysql -u root -p

Enter the password and log in successfully. This is the end of resetting the password.

created at:09-17-2021
edited at: 09-17-2021: