Reset the mysql password operation command in the Windows environment

  • 2020-05-15 02:21:52
  • OfStack

Local environment: Windows XP system, xampp integrated environment.
xampp installation directory: d:/xampp

1. First stop the running MySQL process
 
>net stop mysql 

If it is not loaded as a service, it can be closed directly in the process manager or service.

2. Start MySQL in safe mode
Enter the mysql directory and run from the command line
 
>d: 
>cd xampp/mysql/bin 
>mysqld.exe --skip-grant-tables 


3. Once you're done, you can access MySQL without using a password
 
>mysql -u root -p 

Press enter directly when prompted for password.

4. Change your password
 
>use mysql 
>update user set Password=password(' The new password ') where User='root'; 
>flush privileges; 


5. Start MySQL service
Close all MySQL processes in the task manager and start with the following command.
 
>net start mysql 

Related articles: