Database Connection Failed
WordPress can't connect to its database (where all your content is stored). This can be caused by incorrect login details, the database server being down, or a corrupted database.
Why this happens
WordPress stores every post, page, setting, and user account in a MySQL database, and connects to it using credentials stored in wp-config.php. If those credentials are wrong, the database server is temporarily overloaded or down, or the database itself has become corrupted, WordPress can no longer reach your content at all.
Step-by-step fix
- Open wp-config.php and check the values for DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST.
- Go to the MySQL Databases section in cPanel and confirm these details are correct.
- If everything looks right, ask your hosting provider whether the database server is running (this is sometimes on their end).
- If you recently changed the database password, remember to update it in wp-config.php too.
How to prevent it happening again
- Never edit database credentials in wp-config.php unless you're also updating them in your hosting's database settings.
- Keep regular database backups so a corrupted database can be restored quickly.
- Monitor your hosting resource usage - shared hosting can throttle database connections during traffic spikes.
😩 Still stuck, or want it fixed without doing it yourself?
I fix WordPress errors like this every day. Send me your error and I'll get your site back up - most fixes are completed within 24 hours.