Skip to content

Error Establishing a Database Connection: How to Fix It on Cloudways

On this page

Last updated: · By

Short answer: The Error Establishing a Database Connection message means WordPress can’t connect to the database. On Cloudways, the usual causes are a crashed MySQL or MariaDB service, wrong connection details in wp-config.php after a migration or clone, a full disk, or a server that ran out of memory. Start by restarting the database service under Manage Services. If that doesn’t help, compare the connection details with Access Details and check server monitoring.

⏱ Time needed: 5–30 minutes, depending on the cause · Difficulty: medium · Last checked against the platform: 6 Nov 2026

What this error actually means

Every WordPress page is built from data stored in the database: posts, settings, users and orders. On each load, WordPress reads the connection details from wp-config.php (database name, user, password and host) and connects to the database service. If the connection fails, it can’t build any page, and it shows this message instead of your site.

On Cloudways servers the database runs on the same server as your site, as a service called MySQL or MariaDB. As of November 2026, Cloudways supports MySQL 8.4 and MariaDB 10.11. That means if the service goes down, every site on the server shows the error. If only one site shows it, the problem is probably in that site’s connection details or tables.

Which three questions should you ask before touching anything?

What you seeWhat it probably meansWhere to jump
Every site on the server shows the errorThe database service is down, the disk is full or memory ran outStep 1 and Step 3
Only one site, right after a migration or cloneWrong connection details in wp-config.phpStep 2
wp-admin shows “One or more database tables are unavailable”Corrupted tablesStep 4
The error appears and disappears during busy hoursThe server is too small for the load, or botsStep 3

What do you need to prepare first?

  • Make sure you have permission to manage the server in the platform (the owner, or a team member with server permissions).
  • Have your SFTP or SSH details ready, so you can open wp-config.php. See connecting to your server with FileZilla.
  • Don’t restore a backup right away. A restore won’t help if the service is down or the disk is full, and it can wipe out orders from the last few hours.

How do you fix Error Establishing a Database Connection, step by step?

Step 1: Restart the database service

This is the first step, and usually the last. Cloudways itself recommends restarting MariaDB or MySQL when you have connection problems.

  1. Log in to the platform, open Servers and select your server.
  2. Under Server Management, choose Manage Services.
  3. Find the MySQL or MariaDB row and check its status.
  4. Click Restart (or Start if the service is stopped), and wait about a minute.
  5. Refresh your site. If it’s back, continue to Step 3 to understand why the service crashed in the first place.
The Manage Services screen showing running Apache, MySQL and Nginx services with Restart buttons
Manage Services: this is where you restart the database service

If the service won’t start, or crashes again after a few minutes, don’t keep clicking Restart. Check the disk and memory first, in Step 3.

Step 2: Compare the connection details in wp-config.php

This is the classic situation after a manual migration, an application clone or a password change: the site arrives with the wp-config.php from the old server, but the application on Cloudways has its own database name, user and password.

  1. In the platform, open Applications and select the application.
  2. On the Access Details tab, under the MySQL details, copy the database name (DB Name), the username and the password.
  3. Connect over SFTP and open public_html/wp-config.php.
  4. Compare DB_NAME, DB_USER and DB_PASSWORD with what you copied. Fix any difference, including stray spaces.
  5. Check DB_HOST too. For a site whose database is on the same server, the value is usually localhost. If a host name from your previous provider was copied in, replace it.
  6. Save the file and refresh the site.
The application's Access Details screen with the site URL, DB details and Redis (hidden)
Access Details: the application’s database details

From the same screen you can click Launch Database Manager and confirm the database exists and has tables. If it’s empty, the migration didn’t include the database, and you need to import it. Details in the guide to managing your database on Cloudways.

Step 3: Check disk, memory and load

A database service doesn’t just crash for no reason. The three common causes are a full disk, running out of memory, and a sudden load spike.

  1. On the server, open Monitoring and check disk, RAM and CPU usage in the summary.
  2. If the disk is full or nearly full, MySQL can’t write and goes down. Free up space using the guide to a full disk and inodes, and only then restart the service.
  3. If RAM peaked during the incident, the operating system probably killed the database to free memory. Scale the server up under Vertical Scaling, or reduce the load.
  4. If CPU spiked for no obvious reason, check application monitoring and the logs for a wave of bots or requests to xmlrpc.php and wp-login.php.
Server monitoring summary: RAM, CPU and disk usage
The monitoring summary: disk, memory and CPU at a glance

If you have Cloudways Copilot, it detects this kind of server problem and suggests an explanation and a fix. Details in the Copilot guide. For ongoing monitoring, see the server monitoring guide.

Step 4: Repair corrupted tables

If the connection itself works but a table is corrupted, WordPress shows a message about unavailable tables. WordPress has a built-in repair tool.

  1. Back up the application before repairing.
  2. In wp-config.php, above the line “That’s all, stop editing”, add: define('WP_ALLOW_REPAIR', true);
  3. Go to /wp-admin/maint/repair.php on your site and click Repair Database.
  4. Right after the repair, delete the line from wp-config.php. That page is open to anyone for as long as the line exists.

For advanced users: with SSH access, from the application’s public_html you can run wp db check and then wp db repair.

Common mistakes and how to fix them

A restart loop: the service comes up and falls over again. The cause is almost always a full disk or memory. Treat the cause, not the symptom. If it’s memory, see why MariaDB restarts because of the OOM Killer.

Changing the database password without updating wp-config.php: if you changed the database password, you need to update it in the file too, exactly as it appears in Access Details. Otherwise the site goes down immediately.

A cache plugin showing an old error: sometimes the database is already back, but Varnish or Breeze is still serving the error page. Clear the application’s cache and check again.

A small server for a WooCommerce store: a 1GB server running an active store with heavy plugins will hit the edge of its memory during busy hours. 2GB is a more sensible starting point for a store.

When to contact support: if the service won’t start even when there’s disk space and free memory, open a ticket with Cloudways support and include the time of the incident. Support is available 24/7.

Black Friday80% off
80% off 2 months of managed hosting

The code BFCM802 takes 80% off your bill for the first two months (up to $200 off per month), including unlimited free site migrations. New customers only, and only until the offer ends.

The offer ends on December 4, 2026 at 23:59 (UTC+2).

Ends in—days—hours—minutes—seconds
Code:
Grab the 80% now

Start with a free trial, no credit card. Enter the code at checkout and check that it shows up.

After Black Friday: 30% off for 3 months with the code ASAEL. On a large server (above about $444 a month) ASAEL already saves more today. BFCM802 vs. ASAEL calculator

Sources

The official sources this page is based on (checked 7 Nov 2026):

Frequently asked questions

What’s the usual cause of the Error Establishing a Database Connection message?

On Cloudways, the usual causes are a crashed MySQL or MariaDB service, and wrong connection details in wp-config.php after a migration. Other causes: a full disk, running out of memory and corrupted tables.

How do I restart MySQL on Cloudways?

Open your server in the platform, choose Manage Services under Server Management, and click Restart on the MySQL or MariaDB row. A restart usually takes less than a minute.

Where do I find my site’s database details on Cloudways?

On the application’s Access Details tab. You’ll find the database name, username and password there, plus a Launch Database Manager button to manage the database from your browser.

Can this error be caused by site load?

Yes. When the server runs out of memory during a traffic spike or a bot attack, the operating system may shut down the database service. If it keeps happening, scale up the server or block the harmful traffic.

Should I restore a backup when the error appears?

Not as a first step. If the service is down or the disk is full, the backup won’t help either, and a restore can wipe out recent data. Restore only if you’ve confirmed that the database itself was deleted or damaged.

Official sources: What Can I Do in the Manage Services Section on Cloudways · Manage Your Databases Using the Cloudways Database Manager (Cloudways Knowledge Base). Written and checked by Asael Dreyer · Updated: 6 Nov 2026

Disclosure: this is an independent site, not the official Cloudways site. Some links on this site are affiliate links: if you sign up through them we earn a commission, at no extra cost to you. Full details

Picture of Asael Dreyer
Asael Dreyer

Hi, I'm Asael Dreyer, CEO of an SEO agency that runs hundreds of websites hosted on dozens of Cloudways servers.
Everything you will find here comes from hands-on experience, mine and my teams', straight from the field: from the guides to the recommendations. All to help you get the most out of Cloudways.

More about me →

Need help? Got a question about your server or this guide? Write to us and we will get back to you.

More guides on this topic:
מפריד
Thanks for your message!
We will get back to you soon.
Ready to get started?

Sign up with the coupon code ASAEL