mysql5.7 Password Forgot

1. Stop the MySQL service

Go to the Task Manager, right-select MySQL57 (some version of the service names may be MySQL) service, and stop the service.

Method 1: Open the Computer Management, locate services, find mysql, manually close

Method 2: Enter the mysql net stop (win10 Home Edition does not apply, the command does not complete)

 

2. Verify skip (skip grant tables)

Method 1: cmd Input:

mysqld --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" --skip-grant-tables

Method 2: Open the next programData directory to find my.ini mysqld field, add skip grant tables below

 

3. Open a cmd in the manual, no password to enter mysql

Enter the following command:

update mysql.user set authentication_string = password('123456') where user='root';
flush privileges

 

4. Restart the computer or restart the mysql service

mysql net start

Guess you like

Origin www.cnblogs.com/hetaoyuan/p/12397337.html
Recommended