If you’re looking to create a local WordPress website on your computer before launching it online, then installing WordPress in XAMPP is the perfect solution.
This step-by-step guide will walk you through the complete installation process of WordPress using XAMPP — from downloading and setting up XAMPP to running your local WordPress dashboard smoothly.

What is XAMPP?

Before we jump into the steps, let’s understand what XAMPP is and why you need it.

XAMPP is a free, open-source software package that allows you to run a local web server on your computer. It includes:

  • Apache (web server)
  • MySQL / MariaDB (database server)
  • PHP (server-side scripting language)
  • Perl

In simple words, XAMPP creates a local hosting environment where you can run and test WordPress websites without needing any online web hosting. It’s widely used by web developers, designers, and bloggers for building and testing sites offline.

Why Install WordPress in XAMPP?

Installing WordPress on XAMPP gives you full control over your website before taking it live. Here are the key benefits:

  1. 🧠 Learn WordPress Offline: Perfect for beginners who want to understand how WordPress works.
  2. 🧱 Test Themes and Plugins: Try out plugins or custom themes safely before uploading to your live site.
  3. 💻 Develop Websites Locally: Build and design your entire website offline without needing hosting.
  4. 🚀 Faster Development: Local testing is quicker since everything runs on your system.
  5. 💰 Completely Free: No hosting or domain costs required during development.

Step 1: Download and Install XAMPP

Let’s start by setting up XAMPP on your computer.

📥 1. Download XAMPP

  • Visit the official Apache Friends website.
  • Choose the right version for your operating system — Windows, macOS, or Linux.
  • Click Download and wait for the installer to finish downloading.

🖥️ 2. Install XAMPP

  • Once downloaded, open the installer file (for example, xampp-windows-x64-installer.exe).
  • You might get a Windows warning message — click Yes to proceed.
  • Follow the installation wizard and select the components you want (keep Apache, MySQL, and PHP checked).
  • Choose the installation directory — usually C:\xampp\.
  • Once installed, open the XAMPP Control Panel.

⚡ 3. Start Apache and MySQL

  • In the XAMPP Control Panel, click Start next to Apache and MySQL.
  • If everything is correct, both modules will turn green indicating they are running.
  • Now your local server is up and ready!

Step 2: Create a Database for WordPress

Every WordPress website requires a database to store data like posts, users, settings, etc.

📂 1. Open phpMyAdmin

  • Open your browser and type:
    👉 http://localhost/phpmyadmin
  • This opens phpMyAdmin, the database management panel included with XAMPP.

🧾 2. Create a New Database

  • Click Databases in the top menu.
  • In the field “Create database,” enter a name such as wordpress_db.
  • Select utf8_general_ci as the collation (default is fine).
  • Click Create.

That’s it! Your new MySQL database for WordPress is now ready.

Step 3: Download and Extract WordPress

Now that your local server is running and you have a database, let’s install WordPress itself.

🌐 1. Download WordPress

📦 2. Extract the Files

  • Once downloaded, extract the WordPress ZIP file.
  • You’ll get a folder named wordpress.

📁 3. Move the Folder to XAMPP Directory

  • Copy or move the entire wordpress folder to the XAMPP htdocs
    directory: C:\xampp\htdocs
  • You can rename the folder to your project name, for example:
    C:\xampp\htdocs\mywebsite

Step 4: Configure WordPress

Let’s now connect your WordPress installation with the database you created earlier.

🧩 1. Start the Installation Wizard

  • Open your browser and go to:
    👉 http://localhost/mywebsite
  • You’ll see the WordPress setup configuration screen.
  • Select your preferred language and click Continue.

💾 2. Database Setup

  • Click Let’s go!
  • You’ll need to enter the following information:
    • Database Name: wordpress_db
    • Username: root
    • Password: (leave blank)
    • Database Host: localhost
    • Table Prefix: wp_ (you can change this if you want multiple installations)
  • Click Submit → then click Run the installation.

Step 5: Complete the WordPress Installation

Once WordPress connects to your database, you can set up your admin details.

✍️ 1. Site Information

Fill in the form with:

  • Site Title: My Local WordPress Site
  • Username: admin (or any name you prefer)
  • Password: a strong password
  • Email Address: your email (optional for local setup)
  • Optionally, check or uncheck the “Discourage search engines” box.

✅ 2. Install WordPress

Click Install WordPress.
After a few seconds, you’ll see a success message — “WordPress has been installed.”

Step 6: Access Your Local WordPress Site

Congratulations! 🎉 You’ve successfully installed WordPress in XAMPP.

🔐 1. Log in to Your Admin Dashboard

Visit:
👉 http://localhost/mywebsite/wp-admin
Enter your username and password, then click Log In.

🏠 2. Visit Your Site

Go to:
👉 http://localhost/mywebsite/
You’ll see your WordPress site running locally.

Troubleshooting Common Issues

Here are a few common issues you may encounter and how to fix them:

🧱 1. Apache or MySQL Not Starting

  • If Apache or MySQL fails to start, it might be due to port conflicts.
  • Open XAMPP Control Panel → click Config → change Apache port to 8080 and MySQL port to 3307.
  • Save and restart the services.

⚠️ 2. Database Connection Error

  • Double-check your database name, username, and password in the configuration setup.
  • Ensure MySQL is running in XAMPP.

📜 3. File Permission Issues

  • On macOS or Linux, ensure the htdocs folder and WordPress files have the correct permissions using:
    sudo chmod -R 755 /opt/lampp/htdocs

Bonus: How to Customize Your Local WordPress Site

Once you’re inside your dashboard, explore the following:

  1. Change Themes: Go to Appearance → Themes → Add New.
  2. Install Plugins: Go to Plugins → Add New to add functionality.
  3. Create Pages and Posts: Start building your website with your desired structure.
  4. Import Demo Content: Many themes offer demo content to make setup faster.

Step 7: Move WordPress from XAMPP to Live Server (Optional)

Once your site is ready locally, you can move it to live hosting using:

  • Plugin method: Use Duplicator or All-in-One WP Migration.
  • Manual method: Export the database and copy files to your live hosting’s public_html folder.

This allows you to deploy the local website exactly as it is online.

Conclusion

Installing WordPress in XAMPP is one of the best ways to learn, test, and build WordPress websites without any hosting costs.
It’s an essential step for developers and beginners alike, giving full control in a private offline environment.

With the process above, you’ve learned how to:

  • Set up XAMPP on your system,
  • Create a MySQL database,
  • Install and configure WordPress locally,
  • Troubleshoot common errors, and
  • Move your site to a live server when ready.

Now you’re all set to start building your dream website — directly from your computer!

FAQ on Installing WordPress in XAMPP

What is XAMPP, and why is it used for WordPress?

XAMPP is an open-source software package that provides a local web server environment. It includes Apache, MySQL, PHP, and Perl, allowing you to run and test WordPress sites locally without needing live web hosting. Developers and beginners use XAMPP to build, test, and design websites safely before publishing them online.

Can I install multiple WordPress sites in XAMPP?

Yes, you can install multiple WordPress websites on XAMPP.
To do this, simply create a new folder inside the htdocs directory for each site (for example,
C:\xampp\htdocs\site1 and C:\xampp\htdocs\site2),
and create a separate database for each in phpMyAdmin.
You can then access each site at
http://localhost/site1 and http://localhost/site2.

Why is WordPress asking for database connection details?

WordPress requires a MySQL database to store website content, settings, and user data. When you install WordPress in XAMPP, you must provide the following:
Database Name (created in phpMyAdmin)
Username (default: root)
Password (usually blank for local setup)
Database Host (localhost)
If any of these values are incorrect, WordPress will show an error saying, “Error establishing a database connection.”

How do I fix Apache or MySQL not starting in XAMPP?

If Apache or MySQL doesn’t start in XAMPP, the most common reason is a port conflict (another application using the same port).
To fix this:
Open the XAMPP Control Panel.
Click on Config → Service and Port Settings.
Change Apache port from 80 to 8080, and MySQL port from 3306 to 3307.
Save the changes and restart XAMPP.
Now, try visiting http://localhost:8080/ to access your local server.

How can I move my WordPress site from XAMPP to a live server?

You can move your local WordPress site to a live server using two methods:
Option 1 – Using a Plugin:
Use plugins like All-in-One WP Migration or Duplicator to export your local site and import it to your live hosting easily.
Option 2 – Manual Method:
Export your database from phpMyAdmin.
Upload all WordPress files from htdocs to your hosting’s public_html folder.
Import the database to your live hosting’s phpMyAdmin.
Update the wp-config.php file with your new hosting credentials.
Change the site URLs in the database (wp_options table).

Shares:
Leave a Reply

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