Tuesday 24 January 2017

How to Recover MySQL Password ?

We need to skip grant tables and start MySQL service. It helps to login MySQL without
password. Once we login MySQL CMD, we can change the password of root accordingly.

root@devops-test:/var/lib# mysqld_safe --skip-grant-tables &
root@devops-test:/var/lib# mysql -u root -D mysql -Bse "update user set password=PASSWORD("***") where User='root'"
root@devops-test:/var/lib# mysql -u root -D mysql -Bse "flush privileges"

No comments:

Post a Comment