How to reset mysql root user password ?

How to reset mysql root user password ?

If you forgot root password of MySql Server. This post gonna help you to reset root user password.

Set / change / reset the MySQL root password on Ubuntu Linux. Enter the following lines in your terminal.

There are few steps below-:

Step-1: Stop Mysql Server

$ sudo /etc/init.d/mysql stop

Step-2: Start the mysqld configuration.

$ sudo mysqld --skip-grant-tables &

Step-3: Login to MySQL as root.

mysql -u root mysql

Step-4: Use the below query to reset your password. Replace NewPassword with your new password.

UPDATE user SET Password=PASSWORD('NewPassword') WHERE User='root'; FLUSH PRIVILEGES; exit;

Congratulations you have changed root password of mysql server.

Gotechnies Sysadmin Blog


Rating: 4.8
Votes: 375
Reviews: 350

One response to “How to reset mysql root user password ?”

  1. Mohit Awasthi says:

    Thak you, sir

Leave a Reply