Installing WordPress on localhost

Install WordPress in a local environment (XAMPP, WAMP, etc.) and access the site via http://localhost/wordpress for development and debugging.


WordPress is one of the most widely used CMS platforms globally. Installing WordPress on localhost allows you to develop themes, test plugins, and write content without affecting the live site.

Prerequisites

You need to have a web server and database running locally. Common combinations include:

  • XAMPP (Apache + MariaDB + PHP)
  • WAMP (Windows)
  • MAMP (macOS / Windows)

Ensure that Apache (or Nginx) and MySQL / MariaDB are started.

Installation Steps

1. Create a Database

Open phpMyAdmin (usually at http://localhost/phpmyadmin), create a new database, for example, wordpress_local, and set the character set to utf8mb4_general_ci.

2. Download WordPress

Download the latest version from wordpress.org and extract it to the web root directory, for example:

htdocs/wordpress/     →  http://localhost/wordpress/
www/wordpress/        →  http://localhost/wordpress/   (WAMP)

3. Run the Installation Wizard

Access http://localhost/wordpress in your browser and fill in the wizard:

  • Database name, username, password (the default user for XAMPP is often root, with no password)
  • Database host: localhost
  • Table prefix: default wp_ is fine

4. Complete Site Information

Set the site title, admin username, and password. After installation, the admin dashboard is usually located at:

http://localhost/wordpress/wp-admin

Common localhost Paths

PathDescription
/wordpressSite homepage
/wordpress/wp-adminAdmin dashboard
/wordpress/wp-content/themes/Theme directory
/wordpress/wp-content/plugins/Plugin directory

Common Issues

Installation page indicates unable to connect to the database
Check if MySQL is running; ensure the database name, username, and password match those in phpMyAdmin; use localhost or 127.0.0.1 as the hostname.

Permalink (pretty URL) 404
Apache needs to have AllowOverride enabled in the site directory, and ensure that a .htaccess file exists. For local development, you can temporarily use “plain” permalinks.

Migrating from local to live
You can use plugins like Duplicator or All-in-One WP Migration, or export the database and replace the site URL.

Summary

In environments like XAMPP / WAMP, the typical access address for WordPress is http://localhost/wordpress. Once the local setup is complete, you can safely develop themes and debug plugins before deploying to the production environment.

访客计数:------ Best viewed in Netscape Navigator · 800×600 © LocalHost Run