Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I screwed up and forgot my server password. I ended up giving up and uninstalled the server was going to try to download ther server again, however, this don't work because the new instance uses the same oasword as the old one. I must've missed removing something or the other. How can I reinstall another instance of the server without dependence on the old password?
Thanks.
Posted

I used the following procedure and it worked very well.


Methods To Recover Lost MySQL Root Password On Linux And Windows
In some conditions we need recover MySQL root password. Following are the steps used on Windows and Linux for recovering the root password.
Recover MySQL root password on Linux
Under Linux we can accomplish the recovery using six steps. You need to be on root login to perform the following steps,
1. Stop MySQL server service.
# /etc/init.d/mysqld stop
2. Start MySQL server without password.
# mysqld_safe --skip-grant-tables &
3. Login into mysql client prompt.
# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.77 Source distribution
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql>
4. Set up new MySQL root password.


mysql> use mysql;

mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';

mysql> flush privileges;

mysql> quit

5. Stop Mysql Server
# /etc/init.d/mysqld stop
6. Start MySQL server and login as root.
# /etc/init.d/mysqld start
# mysql -u root -p
Recover MySQL root password on Windows Systems
Under Windows we can accomplish the recovery using eight steps. Following are the steps,
1. Stop MySQL server service.
Go to Start->Run->services.msc ,Stop MySQL server services.
2. Navigate into MySQL bin folder located inside the MySQL installation path.
Go to Start->Run->cmd
Use “cd” command to change the directory.
cd C:\MySQL\bin\
3. Execute the following command from “C:\MySQL\bin” command prompt.
mysqld.exe -u root --skip-grant-tables
4. Leave the current MS-DOS console as it and open a new MS-DOS console.
Go to Start->Run->cmd
Use “cd” command to change the directory.
cd C:\MySQL\bin\
5. Enter mysql.exe and Enter
mysql>
6. Set up new MySQL root password.


mysql> use mysql;

mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';

mysql> flush privileges;

mysql> quit

7. Close all MS-DOS console and start MySQL server.
Go to Start->Run->services.msc ,Start MySQL server services.
8. Login into MySQL prompt.
Steps would be different according the MySQL installation.
Cheers!


I'm sorry that i did not record the link where I found this, so I give credit to somebody just don't know who.
MLver68
 
Share this answer
 
v2
This might help:

Retrieve SQL Server Password[^]


Oops. My bad - you said "MySql"

http://www.cyberciti.biz/tips/recover-mysql-root-password.html[^]

Google reveals all (I searched for "retrieve mysql password").
 
Share this answer
 
v2
I believe you forgot the root password.
MySQL docs suggests the following method to Reset root password:
http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html[^]

Thereafter, using root you can easily reset the user passwords
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900