Skip to content
CMS Windows

Set Up WordPress Locally Using XAMPP on Windows 11

Richard
Written by
Richard
Updated 6 min read
Set Up WordPress Locally Using XAMPP on Windows 11
Set Up WordPress Locally Using XAMPP on Windows 11
Before you start
  • 5 steps
  • Needs administrator rights

Local WordPress development on Windows 11 with XAMPP lets you build and test websites offline, without a live server. XAMPP is a free bundle of the Apache web server, the MariaDB database and PHP. You install it once and it runs on your PC like any other program.

XAMPP version 8.2.4 or a later release gives you everything needed to run a complete website from your own machine. Treat it as a practice area: you can break things, fix them and try ideas before anything goes online. You need a Windows 11 PC, an administrator account and a browser. Both Home and Pro editions work the same way here.

⚡ Quick Answer

Install XAMPP (version 8.2.4 or later) on Windows 11, start Apache and MySQL in the XAMPP Control Panel, then create a database at http://localhost/phpmyadmin/. Next, download WordPress and place its files in the htdocs folder, such as 📁C:\xampp\htdocs\wordpress. Finally, open http://localhost/wordpress in your browser and complete the WordPress installer, which runs on your PC and stays offline.

Advertisement

Why use a local environment?

Running WordPress locally lets you test themes, try plugins or build a whole site away from public view. Nothing you do is visible to visitors, and a mistake can’t take down a real site. When you finish, you’ll have a fully working website that you can later move to a live server.

Step 1Install XAMPP

XAMPP includes the Apache web server and the database software, so it covers everything WordPress needs. If you have not installed XAMPP yet, our guides below explain how to do it. Install it first, then come back here.

Advertisement

Once XAMPP is installed, open the XAMPP Control Panel and click Start next to both Apache and MySQL. Their names should turn green and show a port number. If a module won’t start, another program is probably using the same port, and the Control Panel log at the bottom will tell you which one. WordPress can’t work until both modules are running.

Install XAMPP on Windows 11

Install XAMPP on Ubuntu 24.04

Step 2Create a WordPress Database

WordPress keeps your posts, pages and settings in a database, so you create that database before you run the installer. phpMyAdmin is the tool bundled with XAMPP for this job. Follow these steps:

  1. Make sure Apache and MySQL are both running in the XAMPP Control Panel.
  2. Open http://localhost/phpmyadmin/ in your web browser. You should see the phpMyAdmin home page with a list of existing databases on the left.
  3. Click the Databases tab.
  4. Type a name for your site’s database in the field under Create database. This guide uses wordpressdb, so use the same name if you want the later steps to match.
  5. Click Create. The new database appears in the list on the left.

That is enough for a local test site. The next section shows a second way to do the same thing from the command line, and it also creates a dedicated database user. You only need one of the two methods.

Advertisement
XAMPP shell button
XAMPP shell button
📝NoteThis step requires administrator privileges.

Open the terminal as an administrator. If you get a permissions error, close the window and reopen it with admin rights. MySQL must be running in the XAMPP Control Panel, or the login will fail.

Open your terminal and run this command to log in to your database server. If it asks for a password and you have not set one, press Enter. A default XAMPP install leaves the database root account without a password. After a successful login you should see a database prompt instead of the normal Windows prompt.

mysql -u root

Now run the commands below, one after another, at the database prompt. Together they create your database and a separate user account that WordPress will use. Using a dedicated user is safer than letting WordPress log in as root, and it is how a live host will work too.

Advertisement
CREATE DATABASE wordpressdb CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; CREATE USER wordpressdbuser@localhost IDENTIFIED BY 'type_your_password_here'; GRANT ALL ON wordpressdb.* TO wordpressdbuser@localhost; FLUSH PRIVILEGES; exit

Remember to replace type_your_password_here with a password you’ll recall. You will type it again in the WordPress setup screen, so write it down somewhere. If you prefer a visual interface, click the Admin button next to MySQL in the XAMPP Control Panel to open phpMyAdmin and work there instead.

Create databse phpMyAdmin
Create databse phpMyAdmin

Step 3Download and Set Up WordPress

WordPress is a set of files that Apache serves from XAMPP’s web folder. So this part means downloading the official package, extracting it and placing the folder in 📁C:\xampp\htdocs. XAMPP reads the files from there and runs your website locally.

Start by opening 📁C:\xampp\htdocs in File Explorer. Create a new folder inside it named wordpress. The folder name becomes part of your site address, so keep it lowercase and without spaces.

XAMPP WordPress folder
XAMPP WordPress folder

Download the latest version of WordPress from official download page. You get a zip file. Right-click it, choose Extract All, and open the extracted wordpress folder. Select everything inside that folder and move it into your new wordpress folder in 📁C:\xampp\htdocs. Move the contents, not the outer folder, or your site will end up in a folder inside a folder. When you are done, files such as wp-config-sample.php and index.php should sit directly in 📁C:\xampp\htdocs\wordpress.

Advertisement
⚠️WarningThis next part is optional.

To have your browser open your site automatically when you visit http://localhost, find the index.html file in 📁C:\xampp\htdocs and replace its contents with the code below. Make a copy of the original file first so you can restore it later. If you skip this, you can still reach your site at http://localhost/wordpress.

<?php if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) { $uri = 'https://'; } else { $uri = 'http://'; } $uri .= $_SERVER['HTTP_HOST']; header('Location: '.$uri.'/wordpress/'); exit; ?>

Save this file. Then go to the XAMPP Control Panel, click Stop next to Apache, wait for it to stop, and click Start again. Apache should show green again.

Step 4Complete the WordPress Installation

The last part runs in your browser. You open the WordPress setup wizard, enter the database details you created earlier, and WordPress connects to the database and builds your site. Before you start, check that Apache and MySQL are still running in the XAMPP Control Panel.

Open your browser and go to http://localhost/wordpress. The setup wizard should load with a language list or a welcome screen. If you see a “not found” error instead, check that the WordPress files are directly inside 📁C:\xampp\htdocs\wordpress.

Advertisement
Wordpress select installation language
Wordpress select installation language

Click Let’s go to start. If the wizard asks you to pick a language first, choose one and continue. The next screen asks for your database details.

WordPress begin installation
WordPress begin installation

Enter the database name (wordpressdb), the username (wordpressdbuser), and the password you created earlier. Leave Database Host set to localhost and leave Table Prefix at its default unless you have a reason to change it. Click Submit. If WordPress reports that it can’t connect, the usual causes are a typo in the password or MySQL not running. Fix that and try again.

WordPress set up database connection
WordPress set up database connection

Click Run the installation. WordPress now confirms it can talk to the database, and the next screen asks about your site.

WordPress set up begin installation
WordPress set up begin installation

Fill in your site title, then create your admin username and password and enter an email address. Even on a local site, use a password you won’t forget, because you will log in with it every time. Click Install WordPress.

Advertisement
WordPress install wordpress
WordPress install wordpress

You are all set! WordPress shows a success message. You can click Log In and sign in with the admin details you just created. After that, you can reach the dashboard at http://localhost/wordpress/wp-admin and the site itself at http://localhost/wordpress.

WordPress set up complete
WordPress set up complete

Summary

By installing XAMPP and setting up a local database, you’ve created a private environment to build your website. You can develop and experiment safely on your own machine. The site only works while Apache and MySQL are running, so start them in the XAMPP Control Panel whenever you want to work on it. When you are finished, you can migrate your local site to a live web host.

[C:xampphtdocswordpress]











Have a question about this guide?

Answered by AI from this guide. Good questions may be added to this page — please don't include personal details.

Did this guide fix your problem?

Richard

About the Author

Richard

Tech Writer, IT Professional

Richard is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.

Advertisement

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *