This article is half-done without your Comment! *** Please share your thoughts via Comment ***
Hello Friends,
Recently, I got a request for resetting the MySQL root password.
One of my colleges tried many solutions from different blog and website, but he failed and the question came to me.
As I am always ready for new research and problem solving, so I started my work to reset the MySQL root password.
On the internet, you can find many similar solutions and I have also tired from these solutions, but I was failed to reset root/admin password.
After some exercise, I got success on this.
Below are the final steps:
Step 1:
Stop MySQL Service.
1 |
sudo stop mysql |
Step 2:
Kill all running mysqld.
1 |
sudo killall -9 mysqld |
Step 3:
Starting mysqld in Safe mode.
1 |
sudo mysqld_safe --skip-grant-tables --skip-networking & |
Step 4:
Start mysql client
1 |
mysql -u root |
Step 5:
After successful login, please execute this command to change any password.
Here you can visit more about MySQL Flush Command:
1 |
FLUSH PRIVILEGES; |
Step 6:
You can update mysql root password .
1 |
UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root'; |
Step 7:
Please execute this command.
1 |
FLUSH PRIVILEGES; |