SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
After using it I cannot enter into mysql.
if i use mysql.exe i cant login, i was able to login using mysql.exe -u root, I can cant understand what is going on there.
I am confused… You didn’t specify a user for setting the password. I would presume that either one of 2 things should have happened. Either the query would have failed, and thus no changes OR the query would have reset ALL passwords, at which time you would need to use the new password.
That being said, if there is now a new password (including for ROOT) then using
mysql.exe -u root
SHOULD fail as you did not present a password. You would need to do one of the following:
mysql.exe -u root -p newpwd
OR
mysql.exe -u root -p
The later of which would PROMPT you for the password.