WordPress Database Error After Enabling Redis or Memcached: A Safe Recovery Guide
Enabling Redis or Memcached should make a WordPress site faster, not take it offline. But a misconfigured cache connection, an incompatible object-cache.php drop-in, or a separate database or server problem can appear as a database outage. Visitors may see “Error establishing a database connection,” a blank page, or a server error.
Start with the fastest reversible checks. Don’t reinstall WordPress, change database credentials at random, or add another cache plugin while the site is down. First record what happened, protect the current configuration, and make one change at a time. This guide covers rapid triage, database credential checks, hosting health, and the relevant wp-config.php settings.
First: Record the Error and Protect the Site
Before making changes, write down the exact error message, the time it first appeared, the last action before the outage, and whether the problem affects the public site, /wp-admin, or both. Save relevant error-log entries with their timestamps. These details help distinguish a cache connection failure from an actual database outage.
Make a backup before changing files or configuration. If the site is unavailable, use your hosting control panel, SFTP, SSH, or your host’s snapshot tool to copy the current files and database if accessible. At minimum, make a copy of wp-config.php and the cache drop-in before editing or moving them.
Check Why it matters Fast, reversible action Exact message and timestamp Shows whether the error began with the cache change or may be unrelated. Record it before changing anything else. Recent cache changes A plugin, drop-in, or server setting may have changed. Note the plugin, settings, and deployment time. Current files Preserves a route back if a fix makes things worse. Copy wp-config.php and object-cache.php.Rapid Outage Triage: Check the Cache Layer First
If the outage began immediately after enabling Redis or Memcached, inspect the cache integration before changing database settings. WordPress object caching is typically loaded through a drop-in file named object-cache.php in the wp-content directory. Unlike an ordinary plugin, a drop-in can load early in the WordPress request, so it may still affect the site even after you deactivate the plugin that installed it.
Temporarily disable the object-cache drop-in
Using SFTP, your file manager, or SSH, locate wp-content/object-cache.php. Rename it to something like object-cache.php.disabled. Renaming is reversible and preserves the file for investigation. Do not delete it as your first step.
Then test the public site and the admin area in a private browser window. If the site loads, the drop-in or its connection to Redis or Memcached is a strong suspect. This does not prove the database was never affected; continue checking logs and server health before declaring the incident resolved.
- What changed: WordPress can no longer load the object-cache drop-in under its expected filename.
- How to roll back: Rename the file back to object-cache.php after confirming the cache service and configuration are correct.
If you have SSH access, you can also check whether a cache plugin is active with WP-CLI, if available. Deactivating the plugin may be useful, but it does not necessarily remove or disable the drop-in. If WP-CLI cannot bootstrap WordPress, avoid forcing database edits just to deactivate a plugin; try the reversible file rename first.
Flush cache only after the site is stable
A flush cache operation removes cached data; it does not repair incorrect database credentials, start a stopped database server, or fix an unreachable Redis service. Once the site is responding, use the cache plugin’s documented flush function or your host’s cache controls. Don’t clear Redis or Memcached globally if the service is shared with other sites or applications unless your host confirms it is safe.
If the outage persists after temporarily disabling the drop-in, keep it disabled while you check the next layers. Avoid repeated toggling: it can make the timeline harder to interpret.
Check Database Credentials Without Guessing
The message “Error establishing a database connection” is a broad symptom. It can mean WordPress cannot reach MySQL or MariaDB, but a cache-related incident may coincide with an unrelated database problem. Compare the current settings in wp-config.php with the database details shown in your hosting panel.
Look for these definitions:
- DB_NAME — the database name.
- DB_USER — the database username.
- DB_PASSWORD — the password assigned to that database user.
- DB_HOST — the database server address, which may be localhost or a host-specific name and port.
Check for a recent migration, password rotation, hosting change, or restored backup. Compare values carefully; don’t paste passwords into public tickets, chat, or screenshots. A database host is not always localhost, especially on managed WordPress or cloud hosting.
If a credential appears wrong, confirm the correct value with the hosting panel or administrator before editing. Save a copy of the original file, make only the confirmed correction, and test the site. Do not reset the database password simply because the cache was enabled.
- What changed: Only the verified incorrect database setting, if one was found.
- How to roll back: Restore the saved wp-config.php copy or put back the previous value if the change causes a new problem.
Review wp-config.php Cache Settings
wp-config.php contains WordPress configuration, including database details and, in some setups, Redis or Memcached constants. The exact settings depend on the cache plugin, drop-in, host, and service. There is no universal set of Redis credentials to paste into every WordPress site.
Review the cache-related lines against the plugin or hosting provider’s documentation. Common issues include a wrong hostname, port, password, database index, socket path, or connection scheme. Also check whether a setting was added twice or whether a value was accidentally placed outside PHP syntax. A missing semicolon or an unmatched quote can cause a PHP error rather than a database error.
Do not publish wp-config.php or share it without removing secrets. It may contain database passwords and cache credentials. If you need to send it to support, use a secure channel and redact sensitive values unless the recipient explicitly needs them.
Check the order and source of settings
Keep configuration changes deliberate. Some cache integrations expect constants in a particular location, often before the “stop editing” comment in wp-config.php. Follow that integration’s instructions rather than copying settings from a different plugin or an unrelated tutorial. If your host manages the cache connection, ask whether the hostname, port, or credentials are injected automatically before adding duplicate values.
- What changed: A cache constant or configuration line was corrected or removed based on the integration’s documentation.
- How to roll back: Restore the saved configuration file, then reapply only verified settings one at a time.
Check Hosting and Server Health
If WordPress still fails with the drop-in disabled, check whether the database and web server are healthy. A full disk, exhausted memory, a database restart, or a hosting-level network issue can all interrupt connections. The cache change may simply have occurred at the same time.
Review your hosting dashboard for service alerts, resource limits, recent maintenance, and database status. If you have access to logs, inspect the PHP error log, web server log, and MySQL or MariaDB log around the recorded incident time. Look for connection errors, authentication failures, timeouts, out-of-memory messages, restarts, or “too many connections” notices.
With SSH access, basic checks may include disk space and service status, but commands and permissions vary by host. On managed hosting, don’t restart services or alter server configuration unless your provider’s guidance allows it.
Possible cause Evidence to look for Next step Database unavailable Database service alert, connection timeout, or restart in logs. Verify service status and ask the provider to check the database node. Resource exhaustion Full disk, memory limits, process limits, or “too many connections.” Identify what is consuming resources before increasing limits or restarting services. Redis or Memcached unreachable Connection refused, timeout, authentication error, or DNS failure. Confirm service status, endpoint, credentials, and network access. PHP configuration error Parse error, fatal error, or undefined constant in PHP logs. Correct the specific line using a saved copy of the configuration.When to Disable the Cache Plugin
If the cache plugin is implicated, disable cache functionality while you investigate. If you can access the dashboard, deactivate the relevant plugin there. If not, you may rename that plugin’s folder inside wp-content/plugins to disable it, then restore the original folder name after testing. This is separate from renaming object-cache.php; you may need to do both, depending on the integration.
- What changed: The cache plugin was deactivated or its folder was temporarily renamed.
- How to roll back: Reactivate it in the dashboard or restore the folder name after checking compatibility and configuration.
Disabling fantasticlawyers.com a cache plugin should not delete the database, posts, or pages, but it can remove cache-related settings or require the plugin to be configured again. Don’t uninstall it during an outage unless you understand what data or files the uninstall process removes.
Restore Carefully and Verify
Once the site loads, keep the cache disabled until you know why it failed. Test the homepage, several internal pages, forms, login, and the admin area. Confirm that WordPress can create or update content and that the database connection remains stable. Review logs again for fresh errors.
When ready to re-enable caching, confirm that the cache service is running, the endpoint and credentials are correct, and the plugin supports your WordPress and PHP versions. Re-enable one component at a time. If the error returns immediately after restoring the drop-in or plugin, disable that component again and preserve the new log entries.

- Confirm the site works with the cache disabled.
- Check the cache service and its documented settings with your host or administrator.
- Re-enable the plugin or drop-in, one at a time.
- Test both front end and admin after each change.
- Flush cache only if the site is stable and the flush is safe for your environment.
What to Send Hosting Support
When server-side checks are needed, give support a useful, specific report rather than only saying the site is down. Include the site URL, first-failure timestamp and time zone, exact error message, recent Redis or Memcached change, steps already taken, and relevant log excerpts with sensitive values removed.
Ask them to confirm whether the database service is healthy, whether the cache service is reachable from the web server, and whether logs show connection failures or resource limits at the recorded time. This directs the investigation without asking them to make an unexplained change.

Prevent the Next Cache-Related Outage
Test cache changes on staging when possible, keep a recent backup, and document the previous settings before enabling a persistent object cache. Confirm whether your host provides Redis or Memcached and whether it requires a particular plugin or drop-in. Keep a short incident record of exact errors, timestamps, and each change.
The safest recovery sequence is simple: record the error, back up the relevant files, temporarily disable the object-cache drop-in, verify database credentials against a trusted source, and check server health. Make one change at a time, label what changed, and keep a clear way to roll back. That approach restores service faster and reduces the risk of turning a cache problem into a larger WordPress outage.