Thursday, July 3, 2014

how to reset a mysql db admin pass if you lost access or forgot the password

It happens sometimes that you put some weird pass and not using it so often you forget it.
Here is how to recover a db pass if you have access to the machine being it physical or virtual :) 

It happens to me at least once every 6 months so from a console:

service mysqld stop
mysqld_safe --skip-grant-tables
mysql --user=root mysql


mysql> update user set Password=PASSWORD('NEWPASS') where user ='root';
mysql> flush privileges;
mysql> exit;
service mysqld stop
service mysqld start



hope you find it useful 

A

No comments:

Post a Comment