1

(37 replies, posted in Installation)

That part of the code was not something we changed, I just included it as it was part of the overall section. But yes, you're right.

So we figured it out. We were able to connect with the db just fine from several other methods. The issue ended up being caused by what seems like a error in the connect_db_mysqli.inc file where it was skipping the

mysqli_select_db($db, $connection["dbname"]);

We changed it to

{
    global $db;

    $db = mysqli_connect($connection["host"], $connection["dbuser"], $connection["dbpassword"], "",
        !empty($connection["port"]) ? $connection["port"] : 3306); // default port in mysql is 3306

    //If no name is selected we will not be able to select a database nor create one just return
    if (!$connection["dbname"])
        return 0;
    
    //Try and select the specified database
    $selectedDB = mysqli_select_db($db, $connection["dbname"]);

    //If the db doesn't exist create the database
    if (!$selectedDB)
    {
        $sql = "CREATE DATABASE IF NOT EXISTS `" . $connection["dbname"] . "`"
            . " DEFAULT COLLATE '" . get_mysql_collation($connection["collation"]) . "'";

        if (!mysqli_query($db, $sql) || !mysqli_select_db($db, $connection["dbname"]))
            return 0;
    } else {
        //else just use the selected db and ensure that the collation is set correclty
         if ($selectedDB)
         {
            if (!db_set_collation($db, $connection["collation"]))
            {
                echo mysqli_error($db);
                return 0;
            }
        }
        else
            return 0;
    }
    return $db;
}

And now it works.

3

(37 replies, posted in Installation)

So we figured it out. We were able to connect with the db just fine from several other methods, including the script above. The issue ended up being caused by what seems like a error in the connect_db_mysqli.inc file where it was skipping the

mysqli_select_db($db, $connection["dbname"]);

We changed it to

{
    global $db;

    $db = mysqli_connect($connection["host"], $connection["dbuser"], $connection["dbpassword"], "",
        !empty($connection["port"]) ? $connection["port"] : 3306); // default port in mysql is 3306

    //If no name is selected we will not be able to select a database nor create one just return
    if (!$connection["dbname"])
        return 0;
    
    //Try and select the specified database
    $selectedDB = mysqli_select_db($db, $connection["dbname"]);

    //If the db doesn't exist create the database
    if (!$selectedDB)
    {
        $sql = "CREATE DATABASE IF NOT EXISTS `" . $connection["dbname"] . "`"
            . " DEFAULT COLLATE '" . get_mysql_collation($connection["collation"]) . "'";

        if (!mysqli_query($db, $sql) || !mysqli_select_db($db, $connection["dbname"]))
            return 0;
    } else {
        //else just use the selected db and ensure that the collation is set correclty
         if ($selectedDB)
         {
            if (!db_set_collation($db, $connection["collation"]))
            {
                echo mysqli_error($db);
                return 0;
            }
        }
        else
            return 0;
    }
    return $db;
}

And now it works.

4

(37 replies, posted in Installation)

I've tried 127.0.0.1 and localhost as hostname, both of which should work. As the user I've even tried as root, and made sure that root does indeed have all privileges. I'm still running into the same error message.

@cambell, that part of the question was asked by @FCazabon. However, I've tried with 127.0.0.1 and localhost respectively, and still am not able to access the db.

6

(37 replies, posted in Installation)

I have manually created the db as per the installation instructions, with a user that has full privileges. The DB is showing when accessed through SSH, but I am still getting the error "Cannot connect to database. User or password is invalid or you have no permittions to create database."

I have tried this solution, and variations thereof, but I still get the message "Cannot connect to database. User or password is invalid or you have no permissions to create database."

8

(37 replies, posted in Installation)

So the first couple of errors are now taken care of. It had not so much to do with the dbname as it had to do with the fact that the db password was too long to be recognized. Once a shorter name was created, most errors went away. Now I'm only stuck with "Cannot connect to database. User or password is invalid or you have no permissions to create database." Any ideas on how to solve this one?

I have the same issue. My php.ini file states

; error_reporting
;   Default Value: E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT

From what I can find other places, this should have solved the issue, but it doesn't. What am I missing?

10

(37 replies, posted in Installation)

Using the modification gave me these errors:
mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in file: /var/www/html/includes/db/connect_db_mysqli.inc at line 206
mysqli_query() expects parameter 1 to be mysqli, boolean given in file: /var/www/html/includes/db/connect_db_mysqli.inc at line 194
Cannot connect to database. User or password is invalid or you have no permittions to create database.

Note: On the first page of installation it checks OK on the config_db.php file, but I have tried every search I know of to locate that file to check if the dbname is included or not, but I am not able to locate the file. Any ideas? (And yes, I did install the latest FA version as per the link given by @apmuthu)

11

(37 replies, posted in Installation)

As mentioned, I've been trying both PHP7 and 5.6

I'll follow up on your comments with a question: You mention a config_db.php I thought this was created by the system during the setup process?

I've followed the steps of the installation guide, meaning extracted all the files at the location where I want them, and created a database. If there's a step I'm missing that needs me to manually create a config_db.php file, this should have been included in the installation guide. Better yet - it should be automated during installation.

I'll try your suggestions, but I don't think this is the solution.

12

(37 replies, posted in Installation)

I get the following error messages when trying to connect to the db:
mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in file: /var/www/html/includes/db/connect_db_mysqli.inc at line 206
mysqli_select_db() expects parameter 1 to be mysqli, boolean given in file: /var/www/html/includes/db/connect_db_mysqli.inc at line 208
mysqli_query() expects parameter 1 to be mysqli, boolean given in file: /var/www/html/includes/db/connect_db_mysqli.inc at line 213
Cannot connect to database. User or password is invalid or you have no permittions to create database.

I have read every thread I have found, but nothing seems to address this issue. One post suggested issues with PHP7, so I added a modification to revert back to PHP5.6. This did not make any difference. I've also read threads suggesting changes to the connect_db_mysqli.inc file, but my file already seems to include the proposed changes.

I've had no problem accessing MySQL via SSH, so I know it's running. Am I missing something obvious? Oh, and I'm using Ubuntu 16.04

Hoping for a solution...