How to Install WordPress Locally on XAMPP

Install WordPress locally on XAMPP to create a development environment for testing themes, plugins, and building websites without a live server. Includes database setup and configuration.

How to Install WordPress Locally on XAMPP

WordPress is the most popular content management system in the world, powering over 40% of all websites. Installing WordPress locally on your computer allows you to build, test, and customize WordPress sites without paying for hosting or being connected to the internet. You can experiment with themes, test plugins, and learn WordPress development in a safe, private environment.

This tutorial assumes you already have XAMPP installed and running with Apache and MySQL services started. If you haven't installed XAMPP yet, follow the XAMPP installation guide first. To understand this tutorial properly, it is helpful to be familiar with PHP basics and phpMyAdmin.

What you will learn in this tutorial:
✓ Downloading WordPress from wordpress.org
✓ Creating a database for WordPress using phpMyAdmin
✓ Extracting and copying WordPress files to htdocs
✓ Configuring wp-config.php with database details
✓ Running the WordPress installation wizard
✓ Setting up admin account and site title
✓ Accessing WordPress dashboard locally

What Is WordPress

WordPress is a free, open-source content management system (CMS) that allows you to create and manage websites without writing code. It started as a blogging platform but has evolved into a powerful tool for building any type of website, including business sites, e-commerce stores, portfolios, forums, and membership sites.

  • Free and Open Source: No licensing costs, thousands of free themes and plugins.
  • Easy to Use: User-friendly dashboard for managing content.
  • Extensible: Thousands of plugins add any functionality you need.
  • SEO Friendly: Built with clean code and SEO best practices.
  • Large Community: Millions of users, extensive documentation, and support.
  • Responsive: Many themes are mobile-friendly out of the box.

Why Install WordPress Locally

  • Free Development: No hosting costs while you learn and build.
  • Test Safely: Experiment with themes and plugins without breaking a live site.
  • Work Offline: Develop anywhere without internet connection.
  • Faster Development: No uploading files to a remote server.
  • Learn WordPress: Perfect environment for learning WordPress development.
  • Client Demos: Build demo sites for client approval before going live.

Step 1: Download WordPress

First, you need to download the latest version of WordPress from the official website.

Download instructions:
1. Open your browser and go to: https://wordpress.org/download/
2. Click the "Download WordPress" button
3. The file is named something like: wordpress-6.x.zip
4. Wait for the download to complete (about 15-20 MB)
5. Do not extract the zip file yet

Step 2: Create a Database for WordPress

WordPress requires a MySQL database to store all your content, settings, user information, and more. You will create a database using phpMyAdmin, which comes with XAMPP.

Database creation steps:
1. Make sure MySQL is running in XAMPP Control Panel (green light)
2. Open your browser and go to: http://localhost/phpmyadmin
3. Click on "New" or "Databases" tab
4. Enter a database name (e.g., wordpress_db)
5. Choose "utf8mb4_general_ci" as the collation
6. Click "Create" button
7. You will see your new database in the left sidebar

Step 3: Extract and Copy WordPress Files

Now you need to extract the WordPress files and copy them to your XAMPP htdocs folder.

File extraction and copying:
1. Extract the downloaded WordPress zip file
2. Inside the extracted folder, you will see a "wordpress" folder
3. Copy this entire "wordpress" folder
4. Navigate to your XAMPP htdocs folder:
   Windows: C:\xampp\htdocs\
   macOS: /Applications/XAMPP/htdocs/
   Linux: /opt/lampp/htdocs/
5. Paste the "wordpress" folder into htdocs
6. You can rename the folder if you want (e.g., "mysite")
7. Your WordPress files are now at: htdocs/wordpress/

Step 4: Configure wp-config.php

WordPress needs a configuration file to connect to the database. You can create it by renaming the sample file or using the WordPress setup wizard.

Manual configuration method:
1. Navigate to your WordPress folder: htdocs/wordpress/
2. Find the file named: wp-config-sample.php
3. Rename it to: wp-config.php
4. Open wp-config.php in a text editor
5. Update the database settings:

define('DB_NAME', 'wordpress_db');     // Your database name
define('DB_USER', 'root');              // Database username
define('DB_PASSWORD', '');              // Database password (empty for XAMPP)
define('DB_HOST', 'localhost');         // Database host

6. Save the file
Security keys (salts) - for better security:
// Generate unique security keys from: https://api.wordpress.org/secret-key/1.1/salt/
// Copy the generated keys and replace the placeholder lines in wp-config.php

define('AUTH_KEY',         'put unique phrase here');
define('SECURE_AUTH_KEY',  'put unique phrase here');
define('LOGGED_IN_KEY',    'put unique phrase here');
define('NONCE_KEY',        'put unique phrase here');
define('AUTH_SALT',        'put unique phrase here');
define('SECURE_AUTH_SALT', 'put unique phrase here');
define('LOGGED_IN_SALT',   'put unique phrase here');
define('NONCE_SALT',       'put unique phrase here');

Step 5: Run the WordPress Installation

With the database created and files in place, you can now run the WordPress installation wizard.

Installation steps:
1. Open your browser
2. Go to: http://localhost/wordpress/
   (or http://localhost/your-folder-name/)
3. Select your language and click "Continue"
4. You will see a welcome screen
5. Click "Let's go!" button
6. Enter the database details you configured:
   - Database Name: wordpress_db
   - Username: root
   - Password: (leave empty)
   - Database Host: localhost
   - Table Prefix: wp_ (leave as default)
7. Click "Submit"
8. Click "Run the installation"

Step 6: Set Up Admin Account

After the database is connected, you need to create an administrator account for your WordPress site.

Admin account setup:
Fill in the following information:

1. Site Title: Enter your website name (e.g., "My Local Site")
2. Username: Choose a username for admin (e.g., "admin")
3. Password: Enter a strong password (write it down!)
4. Your Email: Enter your email address
5. Search Engine Visibility: Uncheck if you want search engines to index your local site

6. Click "Install WordPress" button
7. After installation, click "Log In"
Login credentials (save these):
Login URL: http://localhost/wordpress/wp-admin
Username: [your chosen username]
Password: [your chosen password]

Step 7: Access Your WordPress Dashboard

After successful installation, you can log in to your WordPress dashboard and start building your site.

Accessing your site:
Your local WordPress site URLs:

Frontend (your website):   http://localhost/wordpress/
Backend (admin dashboard): http://localhost/wordpress/wp-admin/

From the dashboard you can:
• Change your site title and tagline
• Install and activate themes
• Install and activate plugins
• Create posts and pages
• Manage users
• Customize your site appearance

Understanding WordPress Dashboard

Menu Item Description
Posts Create and manage blog posts, categories, and tags
Media Upload and manage images, videos, and documents
Pages Create and manage static pages (About, Contact, etc.)
Comments Moderate comments from visitors
Appearance Manage themes, customize site, menus, widgets
Plugins Install and manage plugins to add functionality
Users Manage user accounts and permissions
Tools Import/export content, site health check
Settings Configure site title, reading, discussion, permalinks

Installing Themes Locally

One of the best things about local WordPress is the ability to test any theme for free.

Ways to install themes:
Method 1: From WordPress Dashboard
1. Go to Appearance → Themes
2. Click "Add New"
3. Search for free themes
4. Click "Install" then "Activate"

Method 2: Upload a premium theme
1. Download the theme .zip file from ThemeForest or other marketplace
2. Go to Appearance → Themes → Add New → Upload Theme
3. Choose the .zip file and click "Install Now"
4. Click "Activate"

Method 3: Manual installation
1. Extract the theme folder
2. Copy it to: htdocs/wordpress/wp-content/themes/
3. Go to Appearance → Themes and activate

Installing Plugins Locally

Test any WordPress plugin without purchasing or risking your live site.

Plugin installation methods:
Method 1: From WordPress Dashboard
1. Go to Plugins → Add New
2. Search for free plugins
3. Click "Install Now" then "Activate"

Method 2: Upload premium plugin
1. Download the plugin .zip file
2. Go to Plugins → Add New → Upload Plugin
3. Choose the .zip file and click "Install Now"
4. Click "Activate"

Method 3: Manual installation
1. Extract the plugin folder
2. Copy it to: htdocs/wordpress/wp-content/plugins/
3. Go to Plugins and activate

Common WordPress Local Installation Issues

Problem Solution
Error establishing database connection Check database name, username, password in wp-config.php
White screen of death Increase PHP memory limit or disable recently added plugins/themes
404 errors on pages Go to Settings → Permalinks and click "Save Changes"
WordPress not loading Make sure Apache and MySQL are running in XAMPP
Maximum upload size too small Increase values in php.ini: upload_max_filesize and post_max_size
Increasing PHP limits in php.ini:
# Open php.ini file (C:\xampp\php\php.ini)
# Change these values:

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
memory_limit = 256M

# Save and restart Apache

Moving Local WordPress to Live Server

When your local site is ready, you can migrate it to a live hosting server.

  • Export Database: Use phpMyAdmin to export your WordPress database as SQL
  • Copy Files: Upload all WordPress files to your hosting server via FTP
  • Update Database: Import the SQL file to your live database
  • Update URLs: Replace localhost URLs with your live domain using search/replace tool
  • Update wp-config.php: Update database credentials for live server

What's Next

Congratulations! You now have a fully functional WordPress site running on your local computer. You can now:

Frequently Asked Questions

  1. Do I need internet to use WordPress locally?
    No, once installed, you can run WordPress completely offline. However, themes and plugins from the WordPress repository require internet to download.
  2. Can I have multiple WordPress sites locally?
    Yes. Create separate folders in htdocs (e.g., wordpress1, wordpress2) and create separate databases for each.
  3. What is the default WordPress login URL?
    http://localhost/wordpress/wp-admin/ or http://localhost/wordpress/wp-login.php
  4. How do I reset my WordPress password locally?
    Use phpMyAdmin to change the password hash in the wp_users table, or use the "Lost your password?" link on the login page.
  5. Can I install WooCommerce locally?
    Yes, WooCommerce and any other WordPress plugin works perfectly on localhost.
  6. What should I learn next after installing WordPress locally?
    After installing WordPress, explore theme development, plugin development, and WordPress security best practices.