HI,
I fixed the problem by restarting the whole server through system reboot.
Lessons learnt:
When we get Error establishing a database connection - ensure database server is running.
If Database server is not running and if there are errors with the MySQL/MariaDB, try rebooting the system...