How to Change LOST root User Password in MySQL Database

MySQL Database

MySQL Database

MySQL is very stable, once you setup it could be days or weeks or months when you want to go back into MySQL database.  I found this article from MySQL website that should how to change the users “root” password but I have added my own flavor.

For this demonstration I am going to use an application called DocuWare. MySQL database is used as backend database for DocuWare settings.

STOP

STOP

WE (DOCUWARE, BLOGGER, THIS SITE) ARE NOT RESPONSIBLE FOR ANY DAMAGES. DO IT AT YOUR OWN RISK.

Here are my steps:

1.     Stop and close ALL Programs and services that are using MySQL

2.     Open Command Prompt (Press the Windows Key + r and type CMD and Enter)

3.     In Command Prompt change the directory to where MySQL bin directory is located.

DOS Window

DOS Window

4 .  Execute the following command: mysqld-nt --skip-grant-tables

DOS Window

DOS Window

5.   Open another Command Prompt (Press the Windows Key + r and type CMD and Enter)

6.   In Command Prompt change the directory to where MySQL bin directory is located.

DOS Window

DOS Window

7 .  Now type : mysql

DOS Window

DOS Window

You are login in MySQL database!

8.  Now, type the following command to reset the root password.

DOS Window

DOS Window

The commands are:

Command 1:  UPDATE mysql.user SET Password=PASSWORD('admin') WHERE User='root';

Command 2: FLUSH PRIVILEGES;

9.   Close the second Command Prompt Windows and end the process for mysqld-nt or any MySQL database programs that you may have running.

Task Manager

Task Manager

You are done. Now, you can login into the MySQL database using you favorite tool and change the password to whatever you want.

Finally, because this question came from user that uses DocuWare. I will give the two places where you have to change the password as well.

Place 1:

Under the Authentication server  folder you will find DWAuthenticationServer.exe.settings and towards the bottom of that file you will find the database connection properties.

DWAuthenticationServer.exe.settings

DWAuthenticationServer.exe.settings

After the changes:

DWAuthenticationServer.exe.settings

DWAuthenticationServer.exe.settings

NOTE: You can change to root or admin or any other from MySQL because you should be able to access MySQL and change the users passwords. Once the services start it will encrypt the password.

Place 2:

DocuWare Database Connections

DocuWare Database Connections

YOUR ARE DONE!

About onlinejt

Blogger

,

One Response to How to Change LOST root User Password in MySQL Database

  1. Juan Tenemaza 10/14/2010 at 7:07 pm #

    Trying typing the commands in DOS, sometimes when you do copy and paste it will transfer extra characters MySQL may not interpret.

Leave a Reply

*