How To Recover or Reset Lost MySQL Password On Linux? – POFTUT

How To Recover or Reset Lost MySQL Password On Linux?

I have some PHP applications that run with the MySQL database server. I have set up MySQL database a long time ago and I have forgotten root password of MySQL server. How can I recover and reset the 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

MySQL server locks databases during running. So we need to release the lock by stopping MySQL service.

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 the password by updating users tables password column

LEARN MORE  How To Secure Linux From Automated Attacks?

We will set a new password for the root user.

Start MySQL Server Daemon Normally Again

We will start MySQL daemon again.

echo '

Leave a Reply

Your email address will not be published. Required fields are marked *