• Skip to main content
  • Skip to primary sidebar
  • Home
  • WordPress
  • web Hosting
  • linux
  • mysql
  • nginx
  • apache2
  • devops

Raju Ginni

wordpress tutorials seo hosting etc

change xampp directory windows

August 16, 2025 By Raju Ginne

we installed XAMPP originally into C:\wamp, but then you renamed the folder to C:\xampp.

๐Ÿ‘‰ The problem: XAMPP configuration files and services (Apache, MySQL, etc.) were installed with absolute paths pointing to C:\wamp. When you renamed the folder, those paths are now broken, so it still tries to start from C:\wamp.

Table of Contents

Toggle
    • 1. Check and update configuration paths
    • 2. Check Windows Services
    • 3. Easiest fix (recommended)
    • โœ… Steps to Fix Without Losing Data
      • 1. Backup MySQL databases (important)
      • 2. Fix Apache & MySQL config paths
      • 3. Remove old Windows services
      • 4. Reinstall services with correct path
      • 5. Restore your databases
    • ๐Ÿ”‘ Key Point
    • โœ… If you want to move it in the future (to C:\xampp)
  • 1. Apache config (httpd.conf)
  • 2. Apache extra config (httpd-xampp.conf)
  • 3. MySQL config (my.ini)
  • 4. PHP config (php.ini)
  • 5. Re-register services

1. Check and update configuration paths

  • Go to C:\xampp\ (your renamed folder).

  • Open xampp-control.exe as administrator.

  • If services fail, you need to update config files:

    • Open C:\xampp\apache\conf\httpd.conf
      Search for C:/wamp/ and replace with C:/xampp/

    • Open C:\xampp\php\php.ini and check for old paths.

    • Also check my.ini in C:\xampp\mysql\bin for basedir and datadir.

2. Check Windows Services

  • Press Win + R โ†’ type services.msc โ†’ Enter.

  • Look for Apache and MySQL services.

  • If you installed them earlier, they are registered with C:\wamp\....

  • You need to uninstall and reinstall the services:

    • Open XAMPP Control Panel.

    • Click the red X (service remove) for Apache & MySQL.

    • Then install again (click the checkbox/service install).

3. Easiest fix (recommended)

If you donโ€™t have data inside MySQL yet โ†’
Just uninstall XAMPP completely and reinstall it directly into C:\xampp\. That way all paths are correct from the start.


You already have databases or projects inside C:\wamp that you want to keep.
In that case, donโ€™t just uninstall everything blindly โ€” weโ€™ll do it safely.


โœ… Steps to Fix Without Losing Data

1. Backup MySQL databases (important)

  • Go to C:\wamp\mysql\data\

  • Copy the entire data folder to a safe place (e.g. Desktop).
    (This contains all your MySQL databases)

2. Fix Apache & MySQL config paths

  • Open these files with Notepad:

    • C:\xampp\apache\conf\httpd.conf โ†’ Search for C:/wamp and replace with C:/xampp.

    • C:\xampp\php\php.ini โ†’ Search and update any C:/wamp.

    • C:\xampp\mysql\bin\my.ini โ†’ Update basedir and datadir to:

      basedir="C:/xampp/mysql"
      datadir="C:/xampp/mysql/data"

3. Remove old Windows services

  • Press Win + R โ†’ type services.msc.

  • Look for Apache2.4 or MySQL services pointing to C:\wamp.

  • Stop them โ†’ right-click โ†’ Properties โ†’ check path.

  • Back in XAMPP Control Panel, click the red X to uninstall the broken services.

4. Reinstall services with correct path

  • Open xampp-control.exe as Administrator.

  • Next to Apache and MySQL, click the red X to install services again.
    (Now theyโ€™ll point to C:\xampp.)

5. Restore your databases

  • Copy back your saved data folder into:
    C:\xampp\mysql\data\ (replace if empty).

  • Start MySQL in XAMPP Control Panel โ†’ your databases should appear.


โšก Alternative (cleaner way):
If configs are too messy, reinstall XAMPP directly into C:\xampp, then copy:

  • htdocs (your projects) โ†’ new C:\xampp\htdocs\

  • data (your databases) โ†’ new C:\xampp\mysql\data\


Since we renamed the folder back to C:\wamp, all the paths in httpd.conf, php.ini, and my.ini are valid again โ€” so Apache & MySQL start without errors. โœ…


๐Ÿ”‘ Key Point

XAMPP is path-dependent.
If you install it in C:\wamp, it expects configs & services to always point there. Simply renaming the folder (to C:\xampp or anything else) breaks it, unless you manually update all config files and services.

write the exact find & replace lines for httpd.conf, php.ini, and my.ini so you can just edit quickly?


โœ… If you want to move it in the future (to C:\xampp)

  1. Rename the folder.

  2. Edit:

    • httpd.conf โ†’ change C:/wamp โ†’ C:/xampp

    • php.ini โ†’ update any old paths

    • my.ini โ†’ update basedir and datadir

  3. Remove & reinstall services from XAMPP Control Panel.


๐Ÿ‘‰ For now, if itโ€™s working fine in C:\wamp, you can just leave it there โ€” no harm at all.

Do you want me to show you the exact lines inside httpd.conf and my.ini youโ€™d need to change, in case you ever want to move it permanently to C:\xampp?


1. Apache config (httpd.conf)

Location:

C:\xampp\apache\conf\httpd.conf

Look for these lines (they will currently say C:/wamp/...) and change them:

# Change this
Define SRVROOT "C:/wamp/apache"

# To this
Define SRVROOT "C:/xampp/apache"

# Change this
DocumentRoot "C:/wamp/htdocs"
<Directory "C:/wamp/htdocs">

# To this
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">


2. Apache extra config (httpd-xampp.conf)

Location:

C:\xampp\apache\conf\extra\httpd-xampp.conf

Search for C:/wamp and replace with C:/xampp.
For example:

<Directory "C:/wamp/phpMyAdmin">

becomes:

<Directory "C:/xampp/phpMyAdmin">

3. MySQL config (my.ini)

Location:

C:\xampp\mysql\bin\my.ini

Change these:

# Before
basedir="C:/wamp/mysql"
datadir="C:/wamp/mysql/data"

# After
basedir="C:/xampp/mysql"
datadir="C:/xampp/mysql/data"


4. PHP config (php.ini)

Location:

C:\xampp\php\php.ini

This one usually doesnโ€™t contain hard paths, but search for C:/wamp just in case (sometimes extensions or logs are set with absolute paths). Replace with C:/xampp.


5. Re-register services

  • Open XAMPP Control Panel as Admin.

  • Click the red X next to Apache/MySQL โ†’ uninstall service.

  • Click again to reinstall (now theyโ€™ll use C:\xampp).


โšก After doing this, XAMPP will work fine under C:\xampp.
Your htdocs projects and MySQL data folder can just be moved over safely.

About Raju Ginne

AMFI Registered mutual fund distributor based in Hyderabad. you may contact me for mutual funds SIP investments Whatsapp: 9966367675.
nism certified research analyst

Primary Sidebar

hi i am raju ginni, primalry i manage wordpress websites on GCP cloud platform as a cloud engineer, and create content on passionate things.
you can follow me on youtbe

© 2025 - All Rights Reserved Disclaimer & Privacy Policy