# Database connection failed

Error as follows:

# Database connection failed!

** #### Stack Trace:**

    **File:**  /home/www/.../classes/core/Application.inc.php line 38
    **Function:**  PKPApplication->__construct()

    **File:**  /home/www/.../lib/pkp/includes/bootstrap.inc.php line 58
    **Function:**  Application->__construct()

    **File:**  /home/www/.../index.php line 68
    **Function:**  require("/home/www/.../lib/pkp/includes/bootstrap.inc.php")

I tried this:


and I get

Unable to Connect to 'localhost’

but if I connect on the CLI, I get:

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 19343
Server version: 5.6.40-log MySQL Community Server (GPL)

Copyright © 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> show tables;
ERROR 1046 (3D000): No database selected
mysql> show databases;
| Database |
| information_schema |
| ojs |
| test |
3 rows in set (0.00 sec)

mysql> use ojs
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

So in short, it refuses to connect to the db. The only change was upgrades to php7 and mysql about a year ago.

Nothing else has changed.

Why is it that I can authenticate as the ojs user on the commandline, but not using a localhost port 3306?

also : this is a live server with many other working sites on it (as in, they are working, and live). We have full control of it. Centos 7

The upgrade to PHP7 removes support for the old mysql driver. Everything will now need to use the mysqli driver.

In the config.inc.php:

If coding PHP manually, the prefix to the function names is mysqli instead of mysql, e.g.: mysql_connect becomes mysqli_connect.

Thanks very much that fixed it!