Monday, March 15, 2010

Reset MySQL Password

- Log on as Administrator
- Stop 'MySQL' service if its running (from Service manager or Task Manager)
- Create a text file with the following statements:

UPDATE mysql.user SET Password=PASSWORD('MyNewPass')
WHERE User='root';
FLUSH PRIVILEGES;
(Replace 'MyNewPass' with the password you need to use and also change the Username as needed. In the case of plesk installations, the username is usually 'Admin')

'Update' and 'Flush' statements, each should be given in a single line. 'Update' statement updates the root password and 'Flush' statement tells the server to reload the grant tables into memory.

- Save the file

- Start MySQL server special --init-file option

On the command window, give the following statement.
C:\> C:\mysql\bin\mysqld-nt --init-file=C:\mysql-init.txt

(Change the paths according to the installation folder)

Restart the service in normal mode.

Reference : http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html