I've just installed WAMP and tried to change root password. The cmd shows the below error. How to fix?


C:\wamp\bin\mysql\mysql5.5.24\bin>mysqladmin -uroot PASSWORD root


mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
  • Did you already have a password or was it blank when setting up? – random Sep 8 '12 at 13:58
  • I think it's blank because I've just installed it – emeraldhieu Sep 8 '12 at 14:07
C:\wamp\bin\mysql\mysql5.5.24\bin\mysqladmin -u root password NEWPASSWORD


c:\wamp\bin\mysql\mysql5.5.24\bin>mysqladmin --help
  -u, --user=name     User for login if not current user.
  password [new-password] Change old password to new-password in current format

Another solution:

  • @Emerald214 is it work for you yes/no? Accept it or post comment it doesn't work.. – Peter Sep 9 '12 at 18:08

sometimes this problem occurs because of different port numbers. mysql's default port number is 3306 but some settings of wamp server makes this 3307 or 3308 or something different. If you change default port number to 3306 for mysql from the settings (Right Click wampserver icon > Tools > Ports used by mysql > use a port other then ...) of wamp server it will give permission.

  • or you can use root@localhost:3308 (or port number which assigned currently to mysql, in my situation it was 3308) – ewroman Feb 9 '20 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.