Bypass Root Password of MySQL Server
Bypass root password, you can change and recover the MySQL root password if you have forgotten it. You can only get it once from a log file. Be default, there won’t be any password set for the root user. you can simply hit MySQL on the server.
We can set the password using the mysql_secure_installation command. it will remove an unnecessary database, user and also disable the remote root login.
I’m going to the login database server with any password obviously it will not allow me so here is the solution. MySQL stores the temporary password in the log file.
Check Out: Basic Commands of MySQL Server In Daily Use
See I got the message access denied Error 1045
Run this command to get a temporary password to login on the database server.
grep ‘temporary password’ /var/log/mysqld.log
This will provide you with the temporary password to login MySQL server. So you can log in with that password then update the root password.
If you face any issue in running above command then try to stop mysqld service and again run the above command.
You’re done change mysql password recover root