Tuesday, November 8, 2011

Recover MySQL root Password

Do you forgot your mysql root password ?...... that was big trouble for you..
don't think about that . you can use following command to recover that password.

1: Stop the MySQL server process.

# /etc/init.d/mysql stop


(output - Stopping MySQL database server: mysqld. )


2: Start the MySQL (mysqld) server/daemon process with the --skip-grant-tables option so that it will not prompt for password.

# mysqld_safe --skip-grant-tables &

3: Connect to mysql server using mysql client:

# mysql -u root



4: setup new password

mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit


5: Stop MySQL Server:

    # /etc/init.d/mysql stop

6: start mysql server

# /etc/init.d/mysql start
# mysql -u root -p




finally apply your new password and get some fun..
thank you.....:)


No comments:

Post a Comment