Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared hosting Managed WordPress Cloud hosting VPS hosting By reader location Hosting finder
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Blog Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Setup & site building · Guide

How to Install WordPress on XAMPP (Local Setup Step by Step)

How to Install WordPress on XAMPP (Local Setup Step by Step)

Short answer

To add WordPress to XAMPP, install XAMPP, start Apache and MySQL in the XAMPP Control Panel, and create an empty database in phpMyAdmin. Then unzip WordPress into a folder inside xampp/htdocs and open localhost plus that folder name in your browser. Enter the database name, user root and an empty password, and finish the installer.

Key takeaways

  • XAMPP bundles Apache, MariaDB, PHP and phpMyAdmin to run WordPress on your own computer.
  • WordPress files go in a folder inside xampp/htdocs, and the site opens at localhost.
  • The default XAMPP database user is root with no password, which is fine only locally.
  • Check that XAMPP's PHP version meets current WordPress requirements before relying on it.
  • A local site is private to your computer; use a migration plugin to move it online.

What is XAMPP and why use it for WordPress?

XAMPP is a free package that installs a web server, database and PHP on your own computer, so you can run WordPress locally for learning, testing themes and plugins, or building a site before it goes live.

XAMPP is made by Apache Friends and is available from the official Apache Friends website. The name stands for cross-platform, Apache, MariaDB, PHP and Perl.

A local site is fast to work on and free, because there is no hosting bill. It is also private: only you can see it, which makes it a safe place to break things. Our guide on setting up a local WordPress development environment compares XAMPP with other local tools.

What do you need before you start?

You need a Windows, macOS or Linux computer with a few gigabytes of free space, administrator rights to install software, and the latest WordPress zip file from WordPress.org.

Download WordPress from the official WordPress download page. Avoid copies from other websites, which may be outdated or modified.

Close programs that use port 80 or 443 before starting, such as other local servers or some chat and video apps. Port conflicts are the most common reason Apache refuses to start.

How do you install XAMPP?

Download the XAMPP installer for your operating system from Apache Friends, run it, keep at least Apache, MySQL, PHP and phpMyAdmin selected, choose an install folder and finish the setup.

On Windows, the default folder is C:\xampp, which works well. Avoid installing inside Program Files, where Windows permissions can block XAMPP from writing files.

Check the PHP version included in the XAMPP build you download. WordPress publishes its server requirements, and current releases recommend a recent PHP version. If XAMPP's bundled PHP is older than what your live host uses, your local tests may not match the real site.

How do you start Apache and MySQL?

Open the XAMPP Control Panel and click Start next to Apache and MySQL; both modules should turn green, which means the web server and database are running.

To check that Apache works, open a browser and visit localhost. You should see the XAMPP welcome page.

If Apache does not start, another program is probably using port 80. Use the Config button to change Apache's port, for example to 8080, and then visit localhost:8080 instead. The Netstat button in the Control Panel shows which programs are using which ports.

How do you create a database for WordPress?

Go to localhost/phpmyadmin, click Databases, type a name such as wordpress_local, leave the collation as default and click Create.

WordPress stores posts, settings and users in this database. One database per local site keeps things tidy, so give each project its own.

The phpMyAdmin documentation explains the interface if you want to explore it later, but for installing WordPress you only need this one step.

You do not need to create a new database user locally. XAMPP's default root user has access to every database. That is fine on your own computer, but never use those settings on a live server.

How do you copy WordPress into XAMPP?

Unzip the WordPress download, rename the extracted wordpress folder to your project name, such as mysite, and move it into the htdocs folder inside your XAMPP install directory.

On Windows, the path becomes C:\xampp\htdocs\mysite. Your local site address is then localhost/mysite.

Make sure the WordPress files sit directly inside the mysite folder. If you see another wordpress folder inside it, move the files up one level, or your address will need an extra folder name.

How do you run the WordPress installer?

Visit localhost/mysite in your browser, choose a language, enter the database name, user root, an empty password and host localhost, then set your site title and admin account.

  1. Open localhost/mysite
  2. Select your language and click Continue
  3. Click Let's go on the database screen
  4. Database Name: wordpress_local
  5. Username: root
  6. Password: leave empty
  7. Database Host: localhost
  8. Table Prefix: keep wp_ or change it
  9. Click Submit, then Run the installation
  10. Enter a site title, username, password and email
  11. Click Install WordPress and log in

The WordPress installation guide covers the same steps for any server, including what each setting means.

Use a real password for your admin account even locally. You may later move the site online, and weak passwords tend to stick.

How do you work with your local WordPress site?

Log in at localhost/mysite/wp-admin to install themes and plugins, write content and test changes exactly as you would on a live site, as long as XAMPP is running.

You must start Apache and MySQL each time you want to use the site. If you see a connection error, check the Control Panel first.

Local sites cannot receive emails or be reached by others, and some plugins that need a public address, such as those connecting to Google services, may not work fully. Our explainer on what Google Site Kit is mentions this limit for one popular plugin.

How do you fix common XAMPP problems?

Most issues come from port conflicts, wrong database details, a low PHP memory or upload limit, or files placed in the wrong folder, and each has a quick fix.

If you see Error establishing a database connection, check that MySQL is running and that the database name in wp-config.php matches the one you created. Our guide to fixing the database connection error covers more causes.

If large theme or plugin uploads fail, raise upload_max_filesize and post_max_size in php.ini, which you can open from the Apache Config button, then restart Apache.

If MySQL stops unexpectedly after a crash, back up the xampp/mysql/data folder before trying any repair, so you do not lose your databases.

Is a XAMPP site secure?

XAMPP is built for local development, not for public servers, so keep it on your own computer and never open its ports to the internet or reuse its default settings on a live site.

Out of the box, the database root user has no password and several admin tools are reachable at localhost. That is convenient for testing but unsafe on a machine anyone else can reach.

If you work on a shared network, such as an office or a café, make sure your firewall blocks outside connections to Apache and MySQL. Most operating systems ask about this the first time XAMPP starts; choose private networks only.

Stop Apache and MySQL in the Control Panel when you are not using them. That frees memory and removes any chance of someone else reaching your local services.

Treat local copies of client sites with care too. They often contain real customer data, so keep your computer encrypted and delete local copies you no longer need.

How do you move a local site online?

Use a migration plugin to export the local site and import it on your host, or copy the files by FTP and move the database with phpMyAdmin, then update the site address.

Migration plugins are the simplest route because they handle URL changes automatically. Our guide on migrating with All-in-One WP Migration walks through one popular option.

After moving, check that images and links point to your real domain, not localhost. A search and replace tool fixes any leftovers.

Is XAMPP the best way to run WordPress locally?

XAMPP is a solid, general-purpose choice, but tools built specifically for WordPress can create sites in one click and switch PHP versions easily, which suits many WordPress users better.

XAMPP shines if you also work on other PHP projects or want to learn how a web server is put together. You see each part, from Apache to the database.

If you mainly build WordPress sites, compare XAMPP with WordPress-focused tools before committing. Either way, keep your local PHP version close to your host's to avoid surprises at launch.

Frequently asked questions

What is the default XAMPP database password for WordPress?

XAMPP's default database user is root with an empty password. Enter root as the username and leave the password field blank in the WordPress installer. Only use these settings on your own computer.

Why does Apache not start in XAMPP?

Another program is usually using port 80 or 443. Close it, or change Apache's port in the XAMPP configuration to something like 8080 and then visit localhost followed by that port number.

Can other people see my XAMPP WordPress site?

No. A XAMPP site runs only on your computer and is reached through localhost. To share it, move it to a web host or use a temporary staging service.

Where do I put WordPress files in XAMPP?

Put them in a folder inside the htdocs directory of your XAMPP installation, such as htdocs then mysite. The site then opens at localhost followed by that folder name.

Can I run several WordPress sites on XAMPP?

Yes. Create a separate folder in htdocs and a separate database for each site, then run the WordPress installer for each one at its own localhost address.

Sources

  1. XAMPP Apache Friends
  2. Download WordPress WordPress.org
  3. Server requirements WordPress.org
  4. How to install WordPress WordPress Developer Resources
  5. phpMyAdmin documentation phpMyAdmin

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

Written and checked byWPLegible Editorial Team Independent WordPress reviews and guides

Researched from the primary sources listed above and checked against our editorial rules before publishing.