1. Find the my.ini file in the MySQL installation directory, and add a line of skip grant tables.
2. Press win, then enter CMD, and right-click to run in administrator mode.
3. Enter the command: net stop Mysql to stop the service first. Next, enter net start Mysql to start the service.
4. After MySQL – uroot – P, enter directly, and then enter.
5. Use MySQL select the MySQL library and execute it. Update user set password = password (“123456”) where user = ‘root’;
6. After the above operations are successful, find the my.ini file in the MySQL installation directory, and then delete skip grant tables.
7. After the above operations are completed, enter the command: net stop Mysql to stop the service first. Next, enter net start Mysql to start the service.