Page 1 of 1

resetting xampp mysql password

PostPosted: 10. December 2008 23:58
by unixadmin
Guys,
I am not able to reset MySQL root password,
mysqld_safe --skip-grant-tables & this command is not working.. please suggest


thanks
tanweer

Re: resetting xampp mysql password

PostPosted: 11. December 2008 00:02
by Wiedmann
Never test this in the last months... but is the batchfile "resetroot.bat" not working?

Re: resetting xampp mysql password

PostPosted: 11. December 2008 00:17
by Sharley
If the .\xampp\mysql\resetroot.bat file fails - which it has in the past, sort out a method below that best suits your needs that gives the required result.

Did you try in http://localhost under menu item Security then click the link:
http://localhost/security/xamppsecurity.php --> MYSQL SECTION: "ROOT" PASSWORD
You will need to know your original MySQL password for this part to work.

If you don't have the original MySQL root user password then here is a clip from my KB (may seem long winded but was first compiled for an absolute new user).
Sharley's KB wrote:Make sure that MySQL is stopped and the MySQL service is uninstalled if you have the service installed

We will need to open 2 Command Console Windows in the xampp\mysql\bin directory and run some commands.

Just in case you are not familiar with how to do that please try and follow these instructions.

Open the first Console Window:
Click on start bottom left of the Windows Task Bar
Click on Run...
Type cmd.exe
Click OK
type cd C:\xampp\mysql\bin (change to your own path)
Press Enter
At the prompt bin> type mysqld --skip-grant-tables
The cursor should now be just flashing on a blank line waiting.
Leave that Console Window open and go to open the second Console Window.


Next, open the second Console Window:
Click on start on the Task Bar again
Click on Run...
Type cmd.exe
Click OK
type cd C:\xampp\mysql\bin (change to your own path)
Press Enter
At the prompt bin> type mysql -u root
Press Enter
At the prompt mysql>type all this UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
Press Enter
At the prompt mysql>type FLUSH PRIVILEGES;
Press Enter
At the prompt mysql>type exit
Press Enter
You should be back at the bin>prompt and job done.

Now just close both Console Windows.

Your MySQL and phpMyAdmin will have user root with password password as set by this part of the above command:
UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
If you want to change from password to a new one of your choice, just change password in between the single quotes to the new one of your choice for example:
UPDATE mysql.user SET Password=PASSWORD('mynewpass') WHERE User='root';

Now open the XAMPP Control Panel and you should see that MySQL is already started - just start Apache now, and to test that the password has indeed changed go to:
http://localhost/phpmyadmin
Enter Username: root and Password: password (or your new password of choice)
click Go