My database won't connect after restoring a backup
Why a restored site can lose its database connection, and how to fix it.
After restoring a backup, your site can occasionally show a database connection error even though the database itself was restored correctly. This usually means your application's configuration file still refers to a database name, username, or password that no longer matches what actually exists on your account.
Steps
- Click Databases in the sidebar and find the database your site should be using. Each row shows the database's full name and its database user.
- Open your application's configuration file (for WordPress, this is
wp-config.php) through File Manager under Files in the sidebar, and compare the database name and username it contains against what's actually shown on the Databases page. - If the password is the mismatch rather than the name, click Manage next to the database, set a New database password, and update your configuration file to match it. The panel stores database passwords hashed, so an old password can't be looked up, only reset.
- Save your configuration file and reload your site.
Tip: if you're not sure which database your site is meant to use, restoring your account's home files usually restores its configuration file correctly at the same time, so double-check that a database restore and a files restore happened together if you did them separately.