Sửa lỗi mysql service detected with wrong path năm 2024

Nếu bạn gặp lỗi Apache service detected with wrong path khi sử dụng XAMPP thì bài viết này có thể giúp được bạn. Đây là lỗi bạn cài đặt XAMPP trên nhiều thư mục khác nhau, nếu bạn không tắt các dịch vụ chạy trên gói cũ đi thì coi như bản cài đặt mới của bạn không hoạt động.

Apache service detected with wrong path

Có nhiều lỗi có thể xảy ra khi bạn sử dụng XAMPP để cài đặt localhost. Và lỗi Apache service detected with wrong path là một trong những ví dụ điển hình.

Bây giờ bạn mở phần mềm Command Prompt (CMD) lên, nhớ là chạy dưới quyền administrator nếu cần thiết nhé. Sau đó bạn tiếp tục gõ vào dòng lệnh sau để xóa đi MySQL đang chạy.

Sau khi bạn chạy dòng lệnh trên rồi mở lại bảng điều khiển của XAMPP và khởi động lại MySQL thử nhé. Nếu đã khắc phục được rồi thì chúng ta tiếp tục sửa tới Apache.

Bạn xem trong bảng điều khiển của XAMPP ở phía bên phải, sẽ có nút tên là Services, bạn nhấn vào đó để xem danh sách các dịch vụ, bạn tìm vần A ở trên cùng và tìm tên của dịch vụ Apache đang chạy. Ví dụ ở đây mình đang thấy có Apache2.4 đang chạy.

Bạn lại sử dụng Command Prompt như mình hướng dẫn bên trên, gõ vào dòng lệnh bênh dưới:

Như vậy là bạn đã làm được rồi đấy, thử khởi động lại Apache trên bảng điều khiển của XAMPP xem nào. Và nhớ là bài viết này chỉ hướng dẫn cách khắc phục lỗi Apache service detected with wrong path, đối với các lỗi khác thì bạn tìm kiếm những bài viết khác nhé.

There are certain error messages in MySQL that lack pointers to the error source. In such cases, it becomes pretty hard to fix the error. One such error message is the ‘MySQL Service Detected with Wrong Path’ error. This problem occurs even after you’ve configured MySQL properly. In this article, learn two ways how you can fix this issue.

What is the ‘MySQL Service Detected with Wrong Path’ error message?

You’re most likely to get this error message when running multiple instances of MySQL on the server.

Take an example of XAMPP. This software distribution is a bundle of the following four services:

  • Apache web server
  • MySQL database
  • PHP
  • Perl

At times, there can be conflict between these services, which would lead to the error message. The complete error message looks like this:

Code:

21:01:50 [mysql] MySQL Service detected with wrong path
21:01:50 [mysql] Change XAMPP MySQL and Control Panel settings or
21:01:50 [mysql] Uninstall/disable the other service manually first

It’s more common in Windows systems.

How to fix this Error?

The solution to this problem depends on the exact cause. And there are two primary causes.

There are multiple instances of MySQL service

As already mentioned, the main reason behind this error is that there are multiple instances of MySQL service running on the same server. There’s a chance that they are in conflict with each other.

By default, MySQL will listen at the port 3306. If there are multiple MySQL instances, then they may utilize the same port.

To fix this issue, you need to analyze the applications active on your server. If you have XAMPP, then you can uninstall the default MySQL instance. That’s because XAMPP has its own web server and database.

You can uninstall using the following command:

Next, you need to run XAMPP as an admin and install MySQL service to the XAMPP interface.

In case you need both MySQL service, it’s advised that you set up the other MySQL instance on another port. This way, there will be no interference.

In XAMPP, you need to edit the my.ini file that’s located at c:\xampp\mysql\bin\. Within this file, find the default port option and change it to a value other than 3306. In addition to that, edit the mysql.default_port parameter in the same file.

Lastly, add the Windows Registry entry and restart the server.

Incorrect MySQL service path

There’s another common reason why you may get this error message. And that is if the MySQL service path is not mentioned correctly.

For example, let’s say you uninstall the default MySQL service and install the XAMPP service in its place. But in the Windows services list, you’ll find that the default MySQL service is listed and it has the old path name.

To fix this issue, you need to update the path name.

If you’re on the Windows server, you need to go to the HKEY_LOCAL_MACHINE > SYSTEMS > CurrentControlSet > Services > MySQL file and update the MySQL path name under the ImagePath parameter.

In case of XAMPP, you need to update the MySQL path name like the following:

Code:

"c:\xampp\mysql\bin\mysqld.exe" --defaults-file="c:\xampp\mysql\bin\my.ini" MySQL

So that’s how you fix the ‘MySQL Service Detected with Wrong Path’ error message. For further assistance, contact the hosting support team.