How to Install WordPress on Localhost (localhost/wordpress)

Install WordPress on XAMPP/WAMP/MAMP at http://localhost/wordpress; admin at /wordpress/wp-admin. Database setup, installer fields, and “cannot connect to database” fixes.


Whether you search how to install wordpress on localhost or open http://localhost/wordpress, the goal is a local WordPress site for themes, plugins, and content without touching production.

Default URLs

PurposeURL
Site homehttp://localhost/wordpress
InstallerOpens automatically on first visit
Adminhttp://localhost/wordpress/wp-admin

Related: http //localhost/wordpress, wordpress localhost.

Stacks: XAMPP, WAMP, MAMP. Database UI: phpMyAdmin.

Prerequisites

Apache and MySQL/MariaDB must be Running in the control panel.

Install steps

1. Create a database

Open http://localhost/phpmyadmin, create e.g. wordpress_local with utf8mb4_unicode_ci (or utf8mb4_general_ci).

2. Download and extract

From wordpress.org/download, extract to the web root:

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

Extracting to the web root itself serves the site at http://localhost/ (no /wordpress prefix).

3. Run the installer

Open http://localhost/wordpress:

FieldTypical local value
Database namewordpress_local
Usernameroot
Passwordoften empty on XAMPP; root on MAMP
Database hostlocalhost
Table prefixwp_

4. Site details & admin

Set title and admin account. Admin URL:

http://localhost/wordpress/wp-admin

Common paths

PathPurpose
/wordpressFront end
/wordpress/wp-adminAdmin
/wordpress/wp-content/themes/Themes
/wordpress/wp-content/plugins/Plugins
/wordpress/wp-config.phpConfig (do not publish secrets)

Troubleshooting

Cannot connect to the database — MySQL running; name/user/password match phpMyAdmin; try host 127.0.0.1.
404 on localhost/wordpress — folder name, Apache, MAMP :8888.
Pretty permalinks 404AllowOverride + .htaccess, or use Plain permalinks locally.

Also: Joomla, Drupal, Magento.

Summary

Standard local path: http://localhost/wordpress; admin /wordpress/wp-admin. Create DB → extract to htdocs/wordpress → open the URL and finish the wizard.

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