Error establishing a database connection
WordPress keeps your pages, posts and settings in a database, and it builds every page from it. This message means WordPress could not reach that database, so it cannot show anything. The error by itself does not delete your content.
First, the four settings in wp-config.php
WordPress says this error is usually caused by a mistake in the file wp-config.php, which holds the details it uses to log in to the database.
- Open your site's files with an FTP client, using the FTP login from your hosting account, or with the file manager in your hosting account.
- In the folder WordPress is installed in, open wp-config.php.
- Find the four database settings: DB_NAME (the database name), DB_USER (its username), DB_PASSWORD and DB_HOST (usually localhost, but not always). Compare the name, username and host with the database in your hosting account.
- Correct any that differ, save the file and load your site again.
If those match and it still fails, or you cannot be sure of the password, WordPress suggests resetting it. In your hosting account's control panel, set a new password for that database user, then put the same password in wp-config.php. The file holds that password, so never send it by email.
Then, ask your host
If the settings are right, write to your hosting company and ask two things:
- Has my database reached its size limit and been shut down?
- Is the database server down?
Either one gives this error, and both are on the host's side.
If it keeps coming back
When the error comes and goes, often while you save a post, the database may be too busy to take more connections rather than gone. One owner's host found their database had grown to 35.68 GB, almost all of it in a single table, wp_options, which normally holds the site's settings. While a post was saved, that table was locked, other requests queued behind it until the host's limit of 20 connections was full, and then WordPress showed this error. WordPress can keep short-lived data in that table too, and heavy use of it can make the table grow.
- Ask your host for the size of your database and of its largest tables, and which entries in wp_options are the largest.
- Ask them to take a backup of the database before anything is deleted or changed.
- The names of the largest entries can show which plugin writes them. Turn that plugin off, or ask its maker, before clearing the table.
- Ask whether the table uses the MyISAM format, which locks the whole table on every write, and whether they can change it to InnoDB, which locks only the rows being written, once the growth has stopped and the backup is taken.
If none of that is it
If the settings are right and your host sees no problem, WordPress advises checking that the site has not been hacked. Scan it with Sucuri SiteCheck.
These steps follow WordPress's guide to common WordPress errors its install guide for the four settings and the password reset, and its page on wp-config.php for where WordPress keeps short-lived data, all read 26 October 2026. The 35.68 GB case, the host's account of the lock and the MyISAM question come from an owner's post and its replies on WordPress's support forum, 19 October 2026.
If you would rather we do it
USD 150once
A one-page site on your own domain, live within 7 days of the day you approve the draft or every dollar back, first year of hosting included.
Terms at kortaga.com/sitesOr write to hello@kortaga.com with your domain.