@Azka Munawar Thank you for posting your question on Microsoft Q&A forum.
When did this error occur and was this working before.?
**How to Fix the Error Establishing a Database Connection in WordPress? **
You get this error when WordPress is unable to establish a database connection. The following reasons could be the reason why the issue occurs:
Database information in wp-config.php file may be incorrect
Use MySQL Client to access your database with the information in wp-config.php to verify this.
Check if both the front end and back end of your WordPress site are returning the different errors
If you are getting a different error on the wp-admin page for instance something like “One or more database tables are unavailable. The database may need to be repaired”, then you need to repair your database. To do this add the following wp-config.php file:
define ('WP_ALLOW_REPAIR', true);
For more details, please check this blog https://azure.microsoft.com/en-us/blog/wordpress-troubleshooting-techniques-on-azure-websites/
Regards,
Oury