Guys,

I got the below given error in one of our Dedicated Server.

“Error establishing a database connection or unavailable to database “
On a first look, it looked as a simple issue which we used to face regularly [ User does not have proper privileges on Database]

But all the domains in the server were having the same issue.

I tried :
>> Granting proper privileges >> Trying to connect DB from backend and it was connecting.

Finally I concluded issue is not related to Mysql and for checking moved php.ini and tried the domains and all the domains were loading fine.

So the issue was related to PHP.

I noticed that sql.safe mode was ON in the php.ini in the server.

I tried disabling sql.safe mode and the issue got resolved.

============== sql.safe_mode = Off ==============