Forgot MySQL root password

I you forgot your MySQL root password, you can recover MySQL database server password with following five easy steps.

  • Stop the MySQL server process.
  • Start the MySQL (mysqld) server/daemon process with the¬†--skip-grant-tables¬†option so that it will not prompt for password.
  • Connect to mysql server as the root user.
  • Setup new mysql root account password i.e. reset mysql password.
  • Exit and restart the MySQL server.

Here are commands you need to type for each step (login as the root user):

  • Stop mysql service
  • Start to MySQL server without password:
  • Connect to mysql server using mysql client:
  • Setup new MySQL root user password
  • Stop MySQL Server:
  • Start MySQL server and test it

Leave a Reply

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