Can someone help me solve for this error message: An exception has been thrown during the rendering of a template ("Craft can't connect to the database with the credentials in craft/config/db.php.") in "components/site-header/_site-header" at line 23.

I am not a developer and can't seem to access back-end of site, either.

This is error message I received there when trying to log in:

Craft can’t connect to the database with the credentials in craft/config/db.php. The above error occurred when the Web server was processing your request. If you think this is a server error, please contact the webmaster. Thank you.

I am afraid I don't know where to start!

Thank you!

  • 1
    Did this just start happening all of a sudden? If so, it sounds like your hosting provider may be having some trouble with their database server. Unless it ends up being an availability issue (i.e. the host restores service after a period of time), this isn't something that can be corrected without access to the files on the server itself, or (likely) without the help of a developer. Next steps should probably be reaching out to the host or the original developer of the site. In the process, please don't disclose any sensitive information like URLs, passwords, or keys! Commented Nov 12, 2021 at 0:12
  • There’s also a Knowledge Base Article that may be helpful: craftcms.com/knowledge-base/…
    – Matt Stein
    Commented Jan 3, 2022 at 20:23


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.