Well, it had been quite sometime since I used MySql and then for some demo I had to. But, the problem was that I had forgotten the password and googling for help told me that I am not the only stupid in this universe . Well here is the solution to the problem:
Stop your MySql service.
Open and command window.
cd to the MySql bin directory (if the MySql bin is not added to your path).
Now run this command
mysqld-nt.exe --skip-grant-tables &
Now open another command window and if required again cd to the MySql bin window and run this command
mysql -u root mysql
In MySQL command line prompt run the following commands:
UPDATE user SET password=PASSWORD("password1234") WHERE user="root";
FLUSH PRIVILEGES;
Yippe... the root password is reset to "password1234" and MySQL will now
know the privileges and you'll be able to login with your new password.
Of course this set of instruction is for Windows and MySQL 5. For Linux, I guess (am not sure, so please look around in the mysql bin directory for correct file name), the command in step 4 will change to "mysqld_safe --skip-grant-tables &" (based of googled results). Rest I believe should be same. In case someone I missed something or you have instruction for other OS/ mysql versions, let me know, will be happy to update it.
No comments:
Post a Comment