Question

After installation of MySQL 5.1.73, I've added the path variable to

C:\Program Files\MySQL\MySQL Server 5.1\bin

And I tried in the command line:

"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install

It shows:

The service already exists!
The current server installed: "c:\Program Files\MySQL\mysqld" --defaults-file=my.ini MySQL

But as you can see the path I set is "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" but not "c:\Program Files\MySQL\mysqld" So no doubt when I type:

net start mysql

I get:

System error 2 has occurred.

The system cannot find the file specified.

How to change the strange wrong directory? I've never set this wrong directory before. My platform is Windows 7 Enterprise

Was it helpful?

Solution

Open registry editör (regedit.exe) then find mysql service (HKLM --> SYSTEM --> CurrentControlSet --> Services --> MySQL) and correct the ImagePath setting.

Updating the path to MySQL in regedit in Windows 10 {Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MySQL}

Alternatively you can search for c:\Program Files\MySQL\mysqld in registry and change to C:\Program Files\MySQL\MySQL Server 5.1\bin

Then run in cmd (admin mode)

  1. cd C:\Program Files\MySQL\MySQL Server 5.1\bin
  2. mysqld.exe --initialize
  3. open services and start mysql service OR run: net start mysql

OTHER TIPS

This error may happen as you install Window recently and didn't to any updates of something. What I took is as follows

  1. Run "regedit.exe" from start button.
  2. From within "Registry Editor" Edit --> Find (Ctrl + F)
  3. Use "mysql" as the "search key"
  4. Now, you would find the following window

enter image description here

  1. Right click [ImagePath] icon and choose "Modify".
  2. Enter your 'mysqld.exe' full pathname there as shown in the above image.

After I did above procedure, no "System error 2" occurred when I execute following command.

DOS> net start mysql

Good luck.

Is this question more appropriate for SuperUser or DBA site?

--install try to run mysql as Windows service. If you only supply --install, it will use the default service name which is MySQL. The error message indicates there is already a Windows service called MySQL so you can't install another service with the same name.

You can first remove the existing service:(Admin command line)

sc delete MySQL

Then run your install command. But before that you have to be sure MySQL service is really deleted, since the service only will be removed after the process ends. If not, then you can kill that mysql process in Task Manager.

The seconde way is leave the existing MySQL service there and create another one:

"C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld" --install MySQL_Instance2 --defaults-file="path-to-my.ini"

But you have to be sure the new my.ini use differenct settings than your existing myslq instance's my.ini like port number, or the new service won't start successfully.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top