When you consult your web page, the hosted code usually makes a connection to the database (hereinafter DB) to know what content should be displayed. This happens with dynamic pages (e.g. PHP), that is, the content is not always the same. Pages whose content does not change are called static pages (e.g. HTML)
Without a connection to the database the code does not have access to the information source to show your web page and usually shows an error message in the browser, for example: Error when establishing a connection with the database, or its variant in English Error Establishing Database Connection.
To solve the error, verify the connection data to the database. To do this, use a database manager or the PhpMyAdmin and make sure that the user and password are valid and that they can see the database and its tables. If this is the case, then you must modify the corresponding configuration file.
Here is an example of a WordPress "wp-config.php" file. You can edit it with an FTP client (for example Filezilla) and modify the following connection parameters:
define ('DB_NAME', '**database_name_here**'); -> the name of the DB define ('DB_USER', '**username_here**'); -> the user of the DB define ('DB_PASSWORD', '**password_here**'); -> the password of the user of DB define ('DB_HOST', '**localhost**'); -> you can leave it as' localhost'`
You can find them by accessing the dashboard of your Hosting service or Cloud service that has DB and click on DB Management.
Normally it is because the password of the user of the database has been modified through the menu DB Management of the SWPanel and the new password has not been defined in the file wp-config.php. However, it can also be due to: