How To Recover or Reset Lost MySQL Password On Linux?


I have some php applications that runs with MySQL database server. I have  setup MySQL database long time ago and I have forgotten root password of MySQL server. How can I recover and reset MySQL Server password?

One way to reset MySQL password is stopping MySQL daemon. Starting it with recovery mode without authentication. Login with root and make required password changes.

Stop MySQL Server Daemon

We will stop MySQL daemon

Start MySQL Server Daemon Recovery Mode

We will start MySQL server daemon in recovery mode so there will be on authentication to connect MySql server daemon. We need root privileges to accomplish these operations.

Connect MySQL Server Without Password

We can connect to MySQL server without password just providing user name root like below.

Set New Password For Root User

We will set password by updating users tables password column

LEARN MORE  How To Create Snapshot of KVM / Libvirt / Qemu Vm?

We will set new password for root user.

Start MySQL Server Daemon Normally Again

We will start MySQL daemon  again.

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)