Dear Visvanath,
Thanks a lot for all the very important point. That worked really well. I would like to share the story because that might be helpful for someone else in another day.
We have separated servers apache and db in our production. In this particular scenario I was using
VM image backups that we have taken in last august. So with out putting much effort I have installed apache on db server because it is for a very short time. Hence in the config.php I have changed only the db
host ip. Then added privileges to db user to access the locally hosted db.
because of your comments I tried to login with specified db user and view whether data tables are visible. There I have realized even though I was able to login to maria db with username and password , moodle data tables were not visible. Most probably issue with database privileges.
Then I have created another user and assigned moodle db privileges , moodle backup works like charm.
Thanks a lot Visvanath for the prompt response.