Monday, May 23, 2011

MySQL Password Reset



Forgetting the root MySQL password is a nuisance especially if the data has been contained into it. If you were in that situation, don't worry, I'm here to the rescue. Just follow the instructions below and your good to go.

1. Log in as an Admin to your system.

2. Stop mysql service. You can do this by opening your command prompt and type 'net stop mysql' then press enter. You can also type services.msc in the Run, look for MySQL in the services and stop the service.

3. Create a text file. The file should contain the following:

UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;

4. Save the file to drive c:\ with the filename mysql-init.txt (actually, any filename should do).

5. Start MySQL service using the command below:
        c:\mysql\bin\mysqld-nt --init-file=c:\mysql-init.txt
        Note* Remember to change (c:\mysql) to the actual root where you have your MySQL installed.

6.  You must be able to start your MySQL with the new password. Execute this command in the command   prompt: mysql -u root -p then press enter. Supply the new password and your done.

Learn More:

No comments:

Post a Comment