IITDU Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Reset root password in MySQL

Go down

Reset root password in MySQL Empty Reset root password in MySQL

Post by BIT0122-Amit Sat Mar 12, 2011 10:59 pm

Today my friend Jobaer asked me to help him reset his password in mysql. He apparently forgot what his password was. And he tried in many ways to reset/change it. None worked. So I decided to give a look.

After a while, I found exactly how to reset mysql password Very Happy The steps are:

Stop MySQL server.

Code:
sudo /etc/init.d/mysql stop

Start MySQL Daemon with grant table skipping.
Code:

sudo mysqld_safe --skip-grant-tables &

Login to MySQL server using username root

Code:
mysql -u root
now, get inside mysql database where user information is kept.

Code:
use mysql;
After that, simply change the password using this command:

Code:
update user set password=PASSWORD("NEW-PASSWORD") where User='root';


Now, flush privileges

Code:
flush privileges;

And then, restart mysql server.

Code:
/etc/init.d/mysql stop

/etc/init.d/mysql start

Test your mysql Password:

Code:
mysql -u root -p

when asked, enter your new password Very Happy
BIT0122-Amit
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

https://iitdu.forumotion.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum