Error is telling you that something happens with the DB so I’m almost sure is not an OJS issue.
It could be a credentials missconfiguration (check the db host/user/pwd with your technical service and confirm are the same you got in config.inc.php) or the DB engine (confirm the engine is up and running).
You have plenty of messages in the forum explaining how to deal with this:
I already checked my database and if it works fine, but when I try to enter ojs 3.1.2 I get the following error message: “Database connection failed!”, where I can verify or reset the access in ojs, the database works correctly
Thanks for the answer, I already verified the access data and if I can enter from phpmyadmin but when wanting to access the portal it sends me the error: “Database connection failed!”, another thing I just noticed the change of domain, from .mx to .net
I already made the adjustments as mentioned but it is still the same, download the database and folders to my local server, change the username and database password and it works fine but when I upload to the server it does not work