Error establishing a database connection error on a site that was working fine previously

Did you checked your wp-config.php file? Is database name or password is changed?

wp-config.php file is located on the root directory you installed wordpress. Open the file and you will see database password, username etc that wordpress use to connect your database. Check the username, passwords are correct.

/** The name of the database for WordPress */
define('DB_NAME', 'your_database_name');

/** MySQL database username */
define('DB_USER', 'your_database_username');

/** MySQL database password */
define('DB_PASSWORD', 'your database password');