Sep 29, 2008

reset mysql root password

Recently, one person left me in his system to solve one of his problem associated with webservice.
He left me and went somewhere and asked me to solve the problem before I left.

During this i requited the mysql root password, but he want there. So i googled to reset the mysql password. And here is what i did to reset the password.

$ sudo /etc/init.d/mysql stop

$ sudo mysqld_safe --skip-grant-tables --user=root

$ sudo mysql -u root

Run this query in mysql prompt:
mysql> UPDATE mysql.user SET Password=PASSWORD('newpassword') WHERE User='root';

Finally kill this mysql process and restart it safely:

$ sudo /etc/init.d/mysql start


No comments: