| Subcribe via RSS

Reset forgotten MySQL root password

July 6th, 2012 Posted in Linux, MySQL

If you forgot your MySQL root password, then this article will help you. This article explains how to reset a forgotten mysql root password.  This process require root access on the server.

Here are the steps:

1. Stop MySQL daemon

# /etc/init.d/mysqld stop

2. Start the mysql dae­mon but skip the grant tables which store the pass­words.

# /usr/bin/mysqld_safe  --skip-grant-tables

You should see mysqld start up successfully

3. Login Using MySQL root User Without Entering Password

# mysqld -u root mysql

4. Set MySQL root password to a new password using UPDATE command

mysql> UPDATE user SET password=PASSWORD('new-password') WHERE user='root';
mysql> flush privileges;

5. Stop MySQL Daemon

# /etc/init.d/mysqld stop

6. Start MySQL Daemon normally

# /etc/init.d/mysqld start

7. Login  to MySQL with the new password

# mysql -u root -p

 

Comments are closed.