I am using MySQL database in Linux environment.
And I forget root user password of MySQL database.
I want to know how to reset the root user password by using command line Linux environment.
So please help me to reset the password by using the command line.
Try these commands.
mysqld_safe --skip-grant-tables &
mysql -u root mysql
in mysql prompt:
update user set password=PASSWORD(“newpassword”) where User=‘root’;
Thanks for you reply.
I tried your solution but that is not work in my case.
Use sudo and try once again, it should work…
Its work but there is one more problem when I was updating root password error occur.
I forget my root password and I want to reset.
What version of Linux are you using? You will have to boot into single user mode and remount the file system as rw and change the password there.
It seems he wants to reset his mysql root password, use sudo for all the commands you give, it will work.