January 1, 2010

How to reset mysql admin password in windows plesk

Once you have logged into the server you via Remote Desktop you will need to take the following steps:

1. Go to 'Start >> Run' and type in 'services.msc'.
2. Now you will need to look for 'MySql Server' In the Services window.
3. Right click on 'MySql Server' and go to 'Properties'.
4. Once you have copied the location of the 'my.ini' file like the following example you will need to go to 'Start >> Run' and then enter in the location of the 'my.ini' file.

C:\Program Files\SWsoft\Plesk\Databases\MySQL\Data\my.ini
5. Under the '[mysqld]' section in the 'my.ini' file you will need to add the following line:

skip-grant-tables
6. Restart 'MySql Server'.
7. Then you will need to login to MySql:

cd C:\Program Files\SWsoft\Plesk\MySQL\bin

C:\Program Files\SWsoft\Plesk\MySQL\bin>mysql -u admin
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7 to server version: 4.1.18-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.


mysql> use mysql;
mysql> UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='admin';
mysql> FLUSH PRIVILEGES;
mysql> quit;
8. Then you will need to remove 'skip-grant-tables' from the my.ini file and restart 'MySql' after resaving the my.ini file.



Method 2
---------------

http://kb.parallels.com/en/3661

You first need to make sure you have MySQL Admin installed as part of the MySQL build.

The below article is taken from the MySQL site:

1.) Log on to your system as Administrator.

2.) Stop the MySQL server if it is running. For a server that is running as a Windows service, go to the Services manager:
Start Menu -> Control Panel -> Administrative Tools -> Services

3.) Find the MySQL service in the list, and stop it. Open a console window to get to the DOS command prompt:
Start Menu -> Run -> cmd

4.) We are assuming that you installed MySQL to `C:\\mysql'. If you installed MySQL to another location, adjust the following commands accordingly. At the DOS command prompt, execute this command:
C:\> C:\mysql\bin\mysqld-nt --skip-grant-tables

This starts the server in a special mode that does not check the grant tables to control access.

5.) Keeping the first console window open, open a second console window and execute the following commands (type each on a single line):
C:\> C:\mysql\bin\mysqladmin -u root flush-privileges password "newpwd"
C:\> C:\mysql\bin\mysqladmin -u root -p shutdown

6.) Replace ``newpwd'' with the actual root password that you want to use. The second command will prompt you to enter the new password for access. Enter the password that you assigned in the first command.

7.) Stop the MySQL server, then restart it in normal mode again. If you run the server as a service, start it from the Windows Services window. If you start the server manually, use whatever command you normally use.

8.) You should now be able to connect using the new password.

These details are also found at the following link:
http://dev.mysql.com/doc/mysql/en/resetting-permissions.html

No comments:

Post a Comment