0

I'm trying to change the root password in MySQL on my development machine (I've just installed MySQL, so it currently doesn't have a password), but it keeps failing with the following error message:

The system cannot find the file specified.

I'm using MySQL 5.1.70 (x86, 32-bit) on Windows 7 SP1 (64 bits). I've added MySQL's "bin" directory to my "Path" environment variable.

In the comments of the MySQL documentation, I read that I should have installed the service using the absolute path, so I stopped MySQL, and uninstalled it:

C:\Windows\system32>mysqld --remove
Service successfully removed.

Then I installed it again, using the absolute path this time:

C:\Windows\system32>C:\web\mysql-5.1.70\bin\mysqld.exe --install
Service successfully installed.

I started MySQL, and tried to change the password again:

C:\Windows\system32>mysqladmin -u root password Pe%8XiduwOqdZ<ZFE5!
The system cannot find the file specified.

I also tried with quotes:

C:\Windows\system32>mysqladmin -u root password 'Pe%8XiduwOqdZ<ZFE5!'
The system cannot find the file specified.

I also tried to change the current directory to MySQL's "bin" directory:

C:\Windows\system32>cd C:\web\mysql-5.1.70\bin

C:\web\mysql-5.1.70\bin>mysqladmin -u root password Pe%8XiduwOqdZ<ZFE5!
The system cannot find the file specified.

C:\web\mysql-5.1.70\bin>mysqladmin -u root password 'Pe%8XiduwOqdZ<ZFE5!'
The system cannot find the file specified.

What's wrong?

migrated from stackoverflow.com Jul 1 '13 at 5:28

This question came from our site for professional and enthusiast programmers.

  • 2
    How about " instead of ' around your password? Windows doesn't recognize the single quote character like unix. – Michael - sqlbot Jul 1 '13 at 6:29
1

There are two techniques you can try:

TECHNIQUE #1

The comment from Michael - sqlbot already said it. Use double quotes

mysqladmin -u root password "Pe%8XiduwOqdZ<ZFE5!"

TECHNIQUE #2

root@localhost has no password. Try running this:

mysql -uroot -e"SET SQL_LOG_BIN = 0; SET PASSWORD = PASSWORD('mynewpassword');"

This should do it as well.

CAVEAT FOR MySQL 5.6 users : TECHNIQUE #2 will not work in Linux for MySQL 5.6. There is a separate file with the temp password for root@localhost ( ${HOME}/.mysql_secret ). You login with that password and change the password from there.

Give it a Try !!!

Your Answer

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