MySQL root password reset linux

Hi,

You can reset forgotten MySQL’s root password by following the below steps.

First stop the running MySQL process by using the following command.

[user@linux]# /etc/init.d/mysql stop

 

Then start the mysql daemon by skipping the grant tables which stores the mysql user passwords.

mysqld_safe --skip-grant-tables &

once it gets started. Login as root using the following command
> mysql --user=root mysql

now reset MySQL root password with the following command

> update user set Password=PASSWORD('new-password') where user='root';
> flush privileges;
> quit

You have reset your root password. Now kill the running MySQL process and restart the MySQL service normally, using the following command

[user@linux]#/etc/init.d/mysql start

Thank you for viewing helpinlinux.com

Reference www.howtoforge.com

Leave a Reply

Protected by WP Anti Spam