Build the URL from the working site
First open the local site’s home page, then append /wp-admin/ to the exact base URL:
| Local site | Admin URL |
|---|---|
http://localhost/wordpress/ | http://localhost/wordpress/wp-admin/ |
http://localhost:8080/wordpress/ | http://localhost:8080/wordpress/wp-admin/ |
http://mysite.local/ | http://mysite.local/wp-admin/ |
http://127.0.0.1:8888/shop/ | http://127.0.0.1:8888/shop/wp-admin/ |
If the home page does not open, solve the web-server, port, database, or container problem first. WordPress login changes cannot fix a refused TCP connection.
Match the symptom
| Symptom | Likely layer | Next check |
|---|---|---|
| Connection refused | Web server is stopped or the port is wrong. | Start the local stack and use its displayed URL. |
| Server 404 | The WordPress directory or virtual host is different. | Find the working site root; confirm the install path. |
| Redirects to another domain or port | WordPress Address / Site Address does not match the local URL. | Inspect the redirect target and local database/config overrides. |
| “Error establishing a database connection” | PHP reached WordPress, but database settings or service failed. | Check the database service and DB_HOST, name, user, and password in wp-config.php. |
| Blank page or PHP fatal error | Plugin, theme, PHP version, or code failure. | Enable log-only WordPress debugging on the local copy. |
| Login form loops back | Cookies, mismatched site URL, HTTPS/proxy headers, or plugin behavior. | Check the final URL, browser cookies for the local origin, and PHP/web logs. |
Recover a lost password
Use the least invasive method available:
- Use Lost your password? when the local environment sends or captures mail.
- If WP-CLI is installed for the project, list users and update the intended account with the documented
wp usercommand. - Use WordPress’s official database or emergency recovery procedures only after backing up the local database and confirming its table prefix.
Do not assume the user ID is 1 or the table is named wp_users. Prefixes and account IDs vary. A direct database edit against the wrong row is destructive.
Log a white screen safely
On a local or staging copy, add these settings before the “stop editing” line in wp-config.php:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
Reload once, then inspect wp-content/debug.log and the PHP/web-server logs. Turn debugging off after the diagnosis. WordPress advises taking a backup before modifications and does not recommend these debug tools for a live site.
Fix a wrong local redirect
- Record the exact
Locationtarget withcurl -Ior browser DevTools. - Check whether
WP_HOMEorWP_SITEURLis defined inwp-config.php. - Otherwise verify the WordPress Address and Site Address values in the database using a supported tool.
- Keep scheme, hostname, port, and subdirectory consistent with the local stack.
A serialized-data search-and-replace should use WP-CLI or another WordPress-aware tool; a blind SQL text replacement can corrupt serialized values.
Official references
- WordPress: Reset your passwordSupported recovery choices and cautions.
- WordPress: Troubleshoot login issuesCookies, passwords, and login troubleshooting.
- WordPress: DebuggingWP_DEBUG, log-only configuration, backup warning, and production caution.
- WP-CLI: wp user updateSupported command-line account updates.