Xampp | 1,025 Views

How to Run XAMPP Apache and MySQL as Windows Services Using NSSM

's Gravatar
Jul 23, 2025

If you are a developer working with XAMPP on Windows, you probably start Apache and MySQL manually every time you boot your computer. Wouldn’t it be great if they started automatically, just like other Windows services?

This is where NSSM (Non-Sucking Service Manager) comes in. It allows you to run almost any executable as a Windows service—making XAMPP’s Apache and MySQL run automatically in the background.

In this guide, I’ll show you how to set up Apache and MySQL as Windows services using NSSM, step by step.

Why Use NSSM for XAMPP?

  • Auto-start on Windows boot
  • Easier service management via services.msc
  • No need to keep XAMPP Control Panel open
  • Runs in the background without manual intervention

Step 1: Download and Install NSSM

  1. Download NSSM from the official site: https://nssm.cc/download.
  2. Extract the zip file (e.g., to C:\nssm).
  3. Open Command Prompt as Administrator.

Step 2: Add Apache as a Service

Run the following command in CMD:

nssm install XAMPP_Apache

An NSSM configuration window will pop up. Fill it like this:

  • Path:
    C:\xampp\apache\bin\httpd.exe
    
  • Startup directory:
    C:\xampp\apache\bin
    
  • Arguments:
    -k runservice
    

Click Install service.

Start the service with:

nssm start XAMPP_Apache

You can also start it via services.msc.

Step 3: Add MySQL as a Service

Run:

nssm install XAMPP_MySQL

Fill in the NSSM GUI:

  • Path:
    C:\xampp\mysql\bin\mysqld.exe
    
  • Startup directory:
    C:\xampp\mysql\bin
    
  • Arguments:
    --defaults-file="C:\xampp\mysql\bin\my.ini" --standalone
    

Click Install service and start it:

nssm start XAMPP_MySQL

Step 4: Auto-Start Services with Windows

If you want these to start automatically on Windows boot:

nssm set XAMPP_Apache Start SERVICE_AUTO_START
nssm set XAMPP_MySQL Start SERVICE_AUTO_START

Alternatively, open services.msc → right-click the service → Properties → set Startup type to Automatic.

Step 5: Verify

  • Visit http://localhost to confirm Apache is running.
  • Open phpMyAdmin or run mysql -u root -p to check MySQL.

Fixing Misconfiguration (Delete Service)

If you misconfigure a service, you can easily remove it:

nssm stop XAMPP_Apache
nssm remove XAMPP_Apache confirm

nssm stop XAMPP_MySQL
nssm remove XAMPP_MySQL confirm

Then reinstall it correctly following the steps above.

Conclusion

By using NSSM, you can make XAMPP’s Apache and MySQL run as Windows services, improving your workflow and saving time. No more manual starts—just boot your computer, and your development environment is ready!

No Img