Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the path of mysql services

Tags:

mysql

windows

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

like image 338
user2690457 Avatar asked May 13 '14 06:05

user2690457


People also ask

What is the default path for MySQL?

For MySQL 5.7 on Windows, the default installation directory is C:\Program Files\MySQL\MySQL Server 5.7 for installations performed with MySQL Installer. If you use the ZIP archive method to install MySQL, you may prefer to install in C:\mysql .


1 Answers

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
like image 124
jdiver Avatar answered Sep 24 '22 08:09

jdiver