Reputation: 2770
I forgot the root password for MySQL 5.5 command line client in Windows 7. I am unable to login. How can I retrieve the password or reset?
Upvotes: 2
Views: 21956
Reputation: 1
i have also faced this thing i actually forgot the root user password of my sql command line i have tried this using several ways in which the instructions are like stopping the MySQL and then passing some query but it didn't work for me so this is what worked for me
open the MySQL installer and then u will saw there are i MySQL installer and 2 shortcut for shell and command line now uninstall the shortcut and
then again reopen the installer here u can reinstall the MySQL completely and then
u can set the new password for the root user in MySQL
so u don't need to do this hard work of running the command
Upvotes: 0
Reputation: 795
RTM : http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html
Here's a step by step procedure :
Important : you need to have system administrator privileges on windows.
1- Stop your MySQL server
2- Create an empty text file, and put these statements in :
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;
You may replace the string 'MyNewPass' by your own password.
3- Save the text file. (eg. c:\temps\mysql-reset-pass.sql )
4- Restart MySQL server and tell it to load the file :
mysqld-nt --console --init-file=c:\temps\mysql-reset-pass.sql
Depending on your MySQL installation, you may also need to give the path to your ini file. In this case, add the "--defaults-file" switch
mysqld-nt --console --init-file=c:\temps\mysql-reset-pass.sql --defaults-file=c:\path\to\my.ini
5- Restart the server normally. You should be able to connect using your new password
Remembrer to delete the text file that you've just created in step 2. It contains the password in clear text.
Upvotes: 5