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
| Purpose | URL |
|---|---|
| Site home | http://localhost/wordpress |
| Installer | Opens automatically on first visit |
| Admin | http://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:
| Field | Typical local value |
|---|---|
| Database name | wordpress_local |
| Username | root |
| Password | often empty on XAMPP; root on MAMP |
| Database host | localhost |
| Table prefix | wp_ |
4. Site details & admin
Set title and admin account. Admin URL:
http://localhost/wordpress/wp-admin
Common paths
| Path | Purpose |
|---|---|
/wordpress | Front end |
/wordpress/wp-admin | Admin |
/wordpress/wp-content/themes/ | Themes |
/wordpress/wp-content/plugins/ | Plugins |
/wordpress/wp-config.php | Config (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 404 — AllowOverride + .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.