Reset MySQL root password - Windows


1. Stop your MySQL server completely.
    If it is running as a service, You can run the following commmand in cmd to stop sql service.

    C:\> net stop mysql

    or

    Start > run > services.msc  > MySQL > right click and select STOP



    If it is not running as a service use the windows taskmanager to stop the server.

2. Open your MS-DOS command prompt using "cmd" inside the Run window. Inside it navigate to your MySQL bin folder, like
   C:\> cd "C:\Program Files\MySQL\MySQL Server 5.0\bin"

3. Execute the following command in the command prompt:

   C:\Program Files\MySQL\MySQL Server 5.1\bin > mysqld.exe -u root --skip-grant-tables

4. Leave the current MS-DOS command prompt as it is, and open a new MS-DOS command prompt window and,
   C:\> cd "C:\Program Files\MySQL\MySQL Server 5.0\bin"

5. Enter the mysql command in the cmd.
  C:\Program Files\MySQL\MySQL Server 5.1\bin > mysql
  Welcome to the MySQL monitor.  Commands end with ; or \g.
  Your MySQL connection id is 181052
  Server version: 5.1.68-cll MySQL Community Server (GPL)

  Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

  Oracle is a registered trademark of Oracle Corporation and/or its
  affiliates. Other names may be trademarks of their respective owners.

  Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

  mysql>


6. Now this time you will be directly login to mysql root user without password. Now execute the following commands in mysql prompt to reset the mysql root password.

   mysql> use mysql;
   mysql> UPDATE user SET Password = PASSWORD('NEW_PASSWORD') WHERE User = 'root';

7. Then close the first command prompt and type "exit;" in the second command prompt to exim from mysql prompt. You can now start the MySQL service.

Leave a Reply