Run WordPress on a USB Drive: Portable Local Setup

5/5 - (6 votes)

Yes—you can run WordPress from a USB flash drive on a Windows computer. Put the portable XAMPP web-server stack and WordPress files on the drive, create a local MariaDB database and open your site at http://localhost/testsite/. The important part is choosing a genuinely portable package and avoiding fixed Windows drive letters: the same USB stick may be E: on one PC and F: on another.

Quick setup

Download the portable XAMPP ZIP or 7z for Windows, extract its xampp folder directly into the USB drive root, run xampp-control.exe, start Apache and MySQL (the control-panel label; XAMPP supplies MariaDB), create a database and copy WordPress into htdocs/testsite.

Scope: this is a local Windows development environment, not a secure production web server or a Mac/Linux portable package. On a PC that blocks running apps from removable drives, the technique will not work without appropriate permissions.

Requirements · Seven setup steps · Move between PCs · Troubleshooting · FAQs

Protect the portable database and test portability

Stop the local database and web-server services before ejecting the drive. Copying files while the database is writing can leave an unreliable backup. Keep a separate backup of both the site files and a database export.

Test on a second permitted computer before relying on the setup for a presentation. Check drive-letter changes, occupied ports and software permissions. Do not bypass an organization’s device controls to run a portable stack.

Localhost refers to the computer running the services; it is not a public publishing address. Use sample data on a portable drive and secure it appropriately. When ready to publish, follow our WordPress migration guide and recheck domain URLs, email and scheduled tasks.

What you need before installing WordPress on USB

  • A Windows PC that permits you to launch the XAMPP control panel and run local Apache and MariaDB processes. This walkthrough is not for macOS or Linux.
  • A reliable USB 3.0 or faster drive with several gigabytes free; an external SSD is preferable for a larger site or many database operations. USB performance affects every WordPress page and admin screen.
  • A portable XAMPP ZIP or 7z archive from Apache Friends’ official SourceForge file collection. The portable Windows 8.2.12 directory contains ZIP, 7z and installer formats; ZIP/7z is the clearest route for a removable drive.
  • The WordPress package from WordPress.org, and a backup of any existing site you intend to move onto the drive.

Version compatibility: WordPress.org currently recommends PHP 8.3 or newer and MariaDB 10.11 or MySQL 8.0 or newer for production hosting. The publicly listed XAMPP Windows 8.2.12 bundle includes PHP 8.2 and an older MariaDB series, so it is useful as a local workshop but does not meet those newest recommended production versions. Choose a modern development stack when testing features that specifically require newer runtimes.

Get portable XAMPP for Windows →

When does portable WordPress make sense?

A USB installation lets a developer demonstrate a local WordPress project on multiple Windows computers without placing an unfinished site on public hosting. It can be useful for a training room, offline prototype or temporary client demonstration. It is not a substitute for a tested off-site backup: flash drives can fail or be lost, and the database must be stopped cleanly before unplugging one. If you only need to share a link with a client, a password-protected staging site on normal hosting is simpler.

Install WordPress on a USB flash drive in seven steps

Step 1. Get the portable XAMPP archive

Open the Apache Friends download page and follow its More Downloads link to the Windows builds on SourceForge. In the relevant release folder, choose a filename that begins xampp-portable-windows- and ends in .zip or .7z. Do not accidentally choose the similarly named standard XAMPP Windows installer: portability is the feature you are trying to preserve.

The public Windows 8.2.12 collection contains a portable ZIP as well as a portable installer. The portable ZIP is a straightforward archive to extract rather than an installer that may write paths or services to one computer.

Illustration of WordPress on a USB flash drive
WordPress, the web-server files and the local database must all travel with the drive.

Step 2. Extract XAMPP directly onto the USB drive

For example, if Windows assigns your USB drive the letter E:, the resulting folder should be E:\xampp\. Check that E:\xampp\xampp-control.exe actually exists before continuing. Avoid a nested folder such as E:\downloads\xampp\xampp\ unless you intentionally adjust paths.

Apache Friends explicitly recommends not running setup_xampp.bat on a removable drive, or choosing relative paths if you do need that script, because the drive letter changes across PCs. That portability detail is more important than the older advice to run every installation wizard’s default steps.

Step 3. Start Apache and the database

Open xampp-control.exe from the drive. Start Apache and MySQL; the latter is the control panel’s label even though XAMPP has shipped MariaDB for years. Visit http://localhost/ in a browser on that same computer. You should see the XAMPP welcome page. Do not enable Windows service installation for the portable stack, and do not authorize public-network access for a local development server.

If Apache does not start, inspect the control-panel log before changing configuration: another process may already occupy port 80 or 443. If MariaDB does not start, do not copy or rename its data files while it is running.

Step 4. Create a separate WordPress database

Visit http://localhost/phpmyadmin/ and open the Databases tab. Create a new database such as testsite. For a local-only XAMPP default installation, the database user may be root with an empty password, but use the credentials your installation actually has. Never deploy a passwordless root account to the internet; XAMPP’s own documentation warns that its development defaults are not suitable for production.

Step 5. Copy the WordPress files to htdocs

Download the official WordPress ZIP and extract it. Inside the USB drive’s xampp\htdocs\ directory create testsite and copy the contents of the extracted WordPress folder into it. Confirm that htdocs\testsite\index.php exists; if the files are one directory deeper, the browser URL will not match this guide.

Creating a WordPress database in phpMyAdmin
Create a distinct database for each local WordPress installation.

Step 6. Run WordPress’s installation screen

Open http://localhost/testsite/ in your browser. Follow the WordPress setup prompts, entering database name testsite, your configured database username and password, and host localhost. Use a unique database table prefix if you reuse a database, though a separate database is clearer. Provide a site title, a non-obvious administrator username and a strong unique password. The WordPress installer creates its configuration file if the directory permissions permit it.

Once installation completes, log in at http://localhost/testsite/wp-admin/. Remember that localhost always means the computer currently running XAMPP, not a publicly accessible address.

Step 7. Shut down correctly and make a backup

Before unplugging the drive, stop Apache and MariaDB through the XAMPP control panel and wait for both to report stopped. Close anything still reading or writing files on the drive, eject it safely, and store a second copy elsewhere. Copying a live database directory while MariaDB is writing can produce a backup that appears complete but will not restore. If the project matters, export a database dump plus the site files, or use a WordPress backup plugin with an off-site destination.

How to use the same USB WordPress site on another Windows PC

Connect the drive, open its xampp folder and launch the control panel. Start Apache and MariaDB, then visit the same local URL. Keeping the xampp folder at the root and using relative paths is intended to allow the drive letter to change. However, plugins, your custom scripts, database settings or SSL configuration may contain absolute paths. If the site fails after moving, check those paths, installed PHP dependencies and local port conflicts rather than assuming the USB drive itself is broken.

Do not run the same database from two PCs simultaneously. A site on removable media is a single local development installation, not a multi-user shared hosting platform.

Common portable WordPress problems and fixes

SymptomWhat to inspect
localhost will not openApache status and log; another app using port 80 or 443; firewall prompts
Error establishing a database connectionMariaDB running; database name and credentials in wp-config.php; incomplete shutdown
Site works only on the original PCAbsolute drive-letter paths, port conflicts, missing permissions and dependencies
Images or links point to a different URLSite URL and old absolute paths in the database; migrate with a tool that handles serialized data
USB drive is extremely slowDrive speed, free space and antivirus scanning; move demanding projects to an SSD

From USB development to a public WordPress website

Do not expose the XAMPP control panel or its local database to the public internet. When the prototype is ready, move the WordPress files and database to a host that meets WordPress’s current recommended PHP and database versions, migrate the local URLs properly, configure HTTPS and test forms, permalinks and email delivery. WPNeon’s WordPress hosting comparison is relevant at that point—not while you are only running an offline demonstration.

Compare hosting for your live site →

Frequently asked questions

Can WordPress run directly from a USB flash drive?

Yes, on a compatible Windows PC if the flash drive contains a portable web server, database and WordPress files. You still need to start Apache and MariaDB before opening the site in your browser.

Which XAMPP download works on a USB drive?

Use a Windows package explicitly named xampp-portable-windows, preferably its ZIP or 7z archive from the official Apache Friends SourceForge collection. Extract the xampp folder to the USB drive root and follow Apache Friends’ relative-path guidance.

Can I move the USB drive between Windows PCs?

Usually, provided each computer permits the local server processes to run and your configuration avoids drive-letter-specific paths. Port conflicts, permissions and custom absolute paths can still prevent the site from starting.

Is portable XAMPP secure for a public website?

No. Apache Friends states that XAMPP is intended for development rather than production and ships permissive default settings. Use a properly configured host for a public site.

Can I use this tutorial on a Mac?

No. The portable ZIP, control panel and paths in this guide are Windows-specific. Use a supported local development environment for macOS instead.

Ready to start? Download the portable Windows XAMPP archive, then the WordPress ZIP. Keep the drive offline from public traffic and complete the single-site test before moving between PCs.