Database connection failed but ojs is connected to that db

Hello All,

I have an installation of OJS. We are currently using OJS-3.1.2-1. We plan to upgrade to OJS-3.3 with a step to OJS-3.2 as advised.

On the test instance we previously had a local DB. We change it recently to an external one, everything is working well with that db.

But while doing the check for the upgrade (php tools/upgrade.php check) I have this error message:

Database connection failed!

ojs2: Database connection failed!
  • Could it be due to the fact that the db is running on a specific port ? (3315 and not 3306 as usual)
  • Why is it written “ojs2” ? We already are on ojs3 ?
  • Or it could be due to the previous local db ?

My credentials in config.inc are correct. I don’t have any message in my error logs related to my database.
We were using PHP 7.0 but I have made an upgrade today to PHP 7.4.
The strange thing is that our OJS is working and is connecting to that db!

Thanks for your help!
Have a nice day.
(I’m completely new to OJS, it’s the first time I work on OJS. I have read several topics with the same error but none solutions helped me)

It could be the port. In the database section of config.inc.php, there is a line for port, which you can uncomment and edit.

It may also be a missing firewall rule. Is the DB host accessible by the OJS host?

The port is well specify in the config.inc.php (as the application is connected to it). The db host is accessible from the OJS host as I succeed to do a mysqldump of the db while connected via ssh to ojs server.

Hello,

I think that I finally fond what was wrong: I didn’t have the mysqli php package.
Running this “sudo apt install php7.4-mysqli” solve the error. (+ had to install the xml package)

Sorry for disturbing.