“Error establishing a database connection” usually means WordPress cannot connect to the database it needs to load your website.
WordPress uses files for code, themes, plugins, and uploads. It uses a database for posts, pages, settings, users, menus, plugin data, and many other parts of the site. If WordPress cannot reach the database, the site may not load.
What the Error Usually Means
The error may happen when:
- The database name is wrong
- The database username is wrong
- The database password is wrong
- The database host is wrong
- The database server is unavailable
- The hosting account has reached a resource limit
- The database is damaged
- A migration changed files but not database settings
- Disk space is full
- The site was compromised
The page may show this error on the public site, the WordPress dashboard, or both.
Check Whether Anything Changed
Database connection errors often appear after a change.
Ask:
- Was the site migrated?
- Was
wp-config.phpedited? - Was a database password changed?
- Was the hosting plan moved?
- Was the domain pointed to a different server?
- Was a backup restored?
- Did the site run out of storage?
- Did a security event happen?
The timeline helps separate a temporary server problem from a configuration issue.
The wp-config.php File
WordPress stores database connection details in a file called wp-config.php.
This file usually contains:
- Database name
- Database username
- Database password
- Database host
If any of these values do not match the database on the hosting account, WordPress cannot connect.
Do not edit this file casually. A single wrong character can keep the site offline. Before editing, take a backup or copy the current values somewhere safe.
Check the Database Itself
The database needs to exist and be reachable.
Check:
- Does the database still exist?
- Does the database user still exist?
- Does the user have access to the database?
- Has the password changed?
- Is the database server running?
- Is the hosting account out of resources?
- Is disk space full?
If you do not know where to check these details, ask your hosting provider or developer. Guessing passwords or hostnames can create more confusion.
Migration Problems
This error is common after a website move.
It can happen if:
- Files were copied but the database was not imported
- The database was imported but
wp-config.phpstill points to the old database - The database user was not created
- The database password changed
- The database host value is different on the new hosting
- The site is pointing to the wrong server
After a migration, website files and database settings have to match the new hosting environment.
Temporary Hosting or Resource Issues
Sometimes the settings are correct, but the database server is temporarily unavailable or overloaded.
This may happen if:
- The hosting environment has a temporary database issue
- The site receives a traffic spike
- A plugin makes heavy database queries
- Disk space or memory limits are reached
- Too many database connections are open
If the error comes and goes, resource usage or database availability may be involved.
Compromise or Corruption
A hacked site, damaged database table, failed update, or broken restore can also cause database trouble.
If the error appeared alongside strange redirects, unknown users, new files, or security warnings, treat it as a possible security issue and avoid deleting files before someone reviews the site.
What to Do First
- Save a screenshot of the error.
- Note when it started.
- Check whether the WordPress dashboard also fails.
- Review recent hosting, migration, password, or restore changes.
- Confirm database credentials in
wp-config.php. - Confirm the database exists and the user has access.
- Check hosting resource usage.
- Restore only if you have a reliable backup and know what may be lost.
If your WordPress site needs a dependable backup option before deeper troubleshooting, you can explore Website Backup through Tech Help Canada Hosting.

We empower people to succeed through practical business information and essential services. If you’re looking for help with SEO, copywriting, or getting your online presence set up properly, you’re in the right place. If this piece helped, feel free to share it with someone who’d get value from it. Do you need help with something? Contact Us
Want a heads-up once a week whenever a new article drops?




