I want to reset mysql root password but I don't want to log into mysql and then reset the password just as follows,
mysql -u root
FLUSH PRIVILEGES;
SET PASSWORD FOR root@'localhost' = PASSWORD('password');
UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root';
Is there a way to achieve this using external command or something?
mysql -u root < resetpassword.txt
. Or you could restart the server withmysqld_safe --init-file=/home/me/resetpassword.txt &
.