@njamar (Noémie Jamar) posted a new topic, subject "Database connection failed but ojs is connected to that db". It read:

   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)

To which @mpbraendle (Martin Brändle) replied

    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?

@njamar (Noémie Jamar) replied

    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.

So @njamar (Noémie Jamar) replied

    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.


{'source': 'discourse', 'url': 'https://forum.pkp.sfu.ca/t/database-connection-failed-but-ojs-is-connected-to-that-db/73336', 'title': 'Database connection failed but ojs is connected to that db', 'views': 98, 'has_accepted_answer': False, 'word_count': 349, 'like_count': 0, 'reply_count': 1, 'participant_count': 2, 'posts': 4, 'tags': '', 'author': '@njamar (Noémie Jamar)', 'participants': '@njamar (Noémie Jamar), @mpbraendle (Martin Brändle)', 'image_url': [None], 'created_at': '2022-05-25T15:22:07.015Z', 'last_posted_at': '2022-06-01T14:25:21.108Z'}