---
title: "How to Install WordPress on Localhost Using XAMPP: Step-by-Step Guide"
description: "Learn how to install WordPress on your local machine using XAMPP in this comprehensive guide. Follow these easy steps to set up a local WordPress…"
url: "https://sajdoko.com/blog/how-to-install-wordpress-on-localhost-using-xampp-step-by-step-guide/"
language: "en"
content_signal: "ai-train=no, search=yes, ai-input=yes"
---
# How to Set Up WordPress on localhost Using XAMPP: A Step-by-Step Guide

 29 September 2024·5 minutes read·[WordPress](https://sajdoko.com/blog/category/wordpress/)     

Install WordPress locally with XAMPP to test themes, plugins and code changes before using them on a live site. The steps below cover the setup.

 

## Step 1: Download and Install XAMPP

 

XAMPP is a free and open-source software that provides a local server environment for PHP and MySQL, both of which are required to run WordPress.

 

- Go to the [XAMPP official website](https://www.apachefriends.org/index.html) and download the appropriate version for your operating system (Windows, macOS, or Linux).
- Once downloaded, run the installer and follow the installation steps. Choose the default options unless you have specific requirements.
- During the installation, ensure that both **Apache** and **MySQL** are selected, as these are the essential services for WordPress.

 

## Step 2: Start Apache and MySQL

 

After installation, open the XAMPP Control Panel. You’ll see several modules listed, including Apache and MySQL. These two modules need to be running to install and use WordPress.

 

- Click the **Start** button next to **Apache** to launch the local server.
- Click the **Start** button next to **MySQL** to launch the MySQL database server.

 

Both modules should now be running. You can confirm this by checking if their status is highlighted in green.

 

## Step 3: Download WordPress

 

Next, you’ll need to download WordPress.

 

- Go to the [WordPress.org download page](https://wordpress.org/download/) and click the download button to get the latest version of WordPress.
- Once downloaded, extract the WordPress ZIP file. You should see a folder named `wordpress`.

 

## Step 4: Move WordPress to XAMPP’s htdocs Folder

 

Now that you have WordPress, you need to place it in the correct directory so that XAMPP can serve it as a website.

  

- Navigate to the directory where XAMPP is installed (commonly `C:\xampp` on Windows or `/Applications/XAMPP` on macOS).
- Find the `htdocs` folder inside the XAMPP directory. This is where you’ll place your WordPress files.
- Copy the `wordpress` folder you extracted earlier into the `htdocs` folder.
- You can rename the folder to anything you like (e.g., `my-local-site`), which will serve as the local URL for your site (e.g., `http://localhost/my-local-site`).

  

## Step 5: Create a MySQL Database for WordPress

 

WordPress needs a database to store its content. You can create a database through the XAMPP Control Panel.

 

- In the XAMPP Control Panel, click the **Admin** button next to **MySQL**. This will open phpMyAdmin, a web-based interface for managing MySQL databases.
- In phpMyAdmin, click the **Databases** tab at the top of the page.
- Under **Create database**, enter a name for your new database (e.g., `wordpress_local`).
- Select **utf8_general_ci** as the collation (this is the recommended setting for WordPress).
- Click **Create** to finish creating the database.

 

## Step 6: Configure WordPress

 

With your database ready, it’s time to configure WordPress to use it. Follow these steps:

 

- In your web browser, go to `http://localhost/your-folder-name` (replace `your-folder-name` with the name of the folder you placed inside `htdocs`).
- WordPress will prompt you to select a language. Choose your preferred language and click **Continue**.
- On the next screen, you’ll see a message that WordPress needs the database information. Click **Let’s go!**.

 

### Enter Your Database Details

 

- **Database Name:** Enter the name of the database you created earlier (e.g., `wordpress_local`).
- **Username:** Use `root` (this is the default MySQL username in XAMPP).
- **Password:** Leave this field blank (the default password for `root` in XAMPP is empty).
- **Database Host:** Leave as `localhost`.
- **Table Prefix:** You can leave this as `wp_` unless you are running multiple installations of WordPress on the same database.

 

Click **Submit** once you’ve filled out all the fields.

 

## Step 7: Complete WordPress Installation

 

After submitting the database information, WordPress will check the connection and proceed to the installation screen. Follow these steps to complete the installation:

 

- Enter a **Site Title** (this can be changed later in the WordPress settings).
- Choose a **Username**, **Password**, and enter your email address.
- You can leave the checkbox for **Discourage search engines from indexing this site** unchecked since this is a local installation.
- Click **Install WordPress** to finish the installation.

 

Once the installation is complete, you’ll be prompted to log in to your new WordPress site. Use the username and password you just created.

 

## Step 8: Access and Manage Your Local WordPress Site

 

WordPress is now installed locally. Open it at `http://localhost/your-folder-name` in your browser.

 

- To manage the site, go to `http://localhost/your-folder-name/wp-admin` and log in with the credentials you created during installation.
- You can now start experimenting with themes, plugins, and customizations in a safe, local environment!

 

## Troubleshooting Tips

 

If you run into any issues during setup, here are some common problems and solutions:

 

- **Apache or MySQL won’t start:** Ensure that no other programs are using the same ports (e.g., Skype or another server). You can change the default ports for Apache and MySQL in the XAMPP settings.
- **Connection error during WordPress setup:** Double-check that your database name, username, and password are correct. Ensure that MySQL is running in the XAMPP control panel.

   

- [Development](https://sajdoko.com/blog/category/development/)
- [WordPress](https://sajdoko.com/blog/category/wordpress/)

   

## Have a project in mind?

 

Write to us and we come back with a concrete estimate within one working day.

  [Contact us →](https://sajdoko.com/contact/)    

## 2 comments

 

1. Roshni 30 December 2024 Im getting “Error establishing a database connection” How to fix this? [Reply](https://sajdoko.com/blog/how-to-install-wordpress-on-localhost-using-xampp-step-by-step-guide/?replytocom=2#respond) 1. sajdoko 3 January 2025 Hi Roshni, This error usually happens because of: 1. Wrong database details in your wp-config.php file (check the database name, username, password, and hostname). 2. MySQL isn’t running in XAMPP (start it from the Control Panel). 3. The database doesn’t exist in phpMyAdmin (double-check and create it if needed). Fix these, and it should work. Let me know if the issue continues! Cheers, [Reply](https://sajdoko.com/blog/how-to-install-wordpress-on-localhost-using-xampp-step-by-step-guide/?replytocom=3#respond)

  

## Leave a comment [Cancel](https://sajdoko.com/blog/how-to-install-wordpress-on-localhost-using-xampp-step-by-step-guide/?format=markdown#respond)

      

## Recent Posts

- [Fleet management software: what do you need beyond GPS?](https://sajdoko.com/blog/fleet-management-software-requirements-beyond-gps/)
- [Custom CRM Development vs Generic SaaS: The ROI Framework for Growing Enterprises](https://sajdoko.com/blog/custom-crm-development-vs-generic-saas/)
- [Web and Software Development Costs in Albania: The International Buyer’s Strategic Guide](https://sajdoko.com/blog/website-costs-in-albania-international-perspective/)
- [Scaling WooCommerce Performance: Eliminating High-Traffic Checkout Bottlenecks](https://sajdoko.com/blog/scaling-woocommerce-performance-checkout-bottlenecks/)
- [The Hidden Cost of Cheap or “Free” Websites: Why €100 Web Design Costs €3,000 Later](https://sajdoko.com/blog/the-hidden-cost-of-cheap-or-free-websites/)

## Recent Comments

1. Alvaro on [Optimizing and Extending the Livewire Product Filter – Part 4](https://sajdoko.com/blog/optimizing-and-extending-the-livewire-product-filter/#comment-4)
2. [sajdoko](https://sajdoko.com) on [How to Set Up WordPress on localhost Using XAMPP: A Step-by-Step Guide](https://sajdoko.com/blog/how-to-install-wordpress-on-localhost-using-xampp-step-by-step-guide/#comment-3)
3. Roshni on [How to Set Up WordPress on localhost Using XAMPP: A Step-by-Step Guide](https://sajdoko.com/blog/how-to-install-wordpress-on-localhost-using-xampp-step-by-step-guide/#comment-2)
