Yetiforcecrm: Unable to connect to database

Created on 12 May 2016  ·  47Comments  ·  Source: YetiForceCompany/YetiForceCRM

Hi everyone,

I want to install yetiforce on a LAMP linux virtual machine and I get an error while the database connection.

My configuration seems to be good because I pass the verification step
image

My database settings are the following
image

And there is the error
capture

I tried on Debian / Ubuntu / Turnkey / Bitnami / Install the package one by one / Install LAMP package... I followed the php.ini recommandations and when i tried with vtiger on the same machine it works!

Thank's in advance !

❔ question

Most helpful comment

I finally found my problem!

The installer doesn't like special chararcters in the password!

All 47 comments

Hi, Try in "Host name" = localhost, without :3306

I arleady tried = localhost, 127.0.0.1 and my ip address with and without the port number.

can you checked if database service are start?. that error is related to access to DB . Not YetiCRM

Yes It is running because vtiger works on an other virtual host. I tried a lot of things and I don't understand why it doesn't work...

Try the following code if it works:

<?php
$mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db');

if ($mysqli->connect_error) {
    die('Connect Error (' . $mysqli->connect_errno . ') '
            . $mysqli->connect_error);
}

if (mysqli_connect_error()) {
    die('Connect Error (' . mysqli_connect_errno() . ') '
            . mysqli_connect_error());
}

echo 'Success... ' . $mysqli->host_info . "\n";

$mysqli->close();
?>

Hi, thank's for the DB test.

I have : Success... Localhost via UNIX socket

But the installation database error is still there.

There is the grant privileges =
image

Okay there is the message = "SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)"

My database have the utf8_general_ci collation if it can help

try to comment variable bind-address in /etc/mysql/my.cnf and restart mysql
otherwise you might have a virtual hosts configuration issue.

I create a new VM with a turnkey LAMP and that the same with the default virtual host.
I wrote the credentials into the Utils.php file but without result.

And I also tried to comment the bind-address in mysqld.cnf

There is the packages versions of the turnkey LAMP
image

Does the error of the mysql can have a link with my connection problem?

I can connect through the mysql console with mysql - u root -p and mysql -u yetiforce -p, so i don't know why it doesn't work with YF...

I try with some others php apllications (vTiger and Owncloud) and the database connection work.

1)active php debug
open terminal
nano rootyetiforce/config/debug.php
set 'LOG4PHP_DEBUG' => true and save (ctrl+o)
service apache2 restart

2)append output from file system.log to yeti.log:
open another terminal
tail -f rootyetiforce/cache/logs/system.log >> /tmp/yeti.log
leaves the terminal active

Open the browser and follow the steps of installation Up to error

3)write the lines of the file yeti.log containing the words "error" or "failed" case-insensitive(-i):
open another terminal
cat /tmp/yeti.log | grep -i error
cat /tmp/yeti.log | grep -i failed

I did It and the files are in the logs folder but empty so my yeti.log is empty.

I'm desperate... I really want to move from vTiger to Yetiforce...

Make a 'test.php' in root folder and execute it with this code (with your own variables of course) and post results please:

<?php

$db_type = 'mysql';
$db_hostname = 'localhost';
$db_username = 'root';
$db_password = 'root';
$db_name = 'yetiforce';
$db_create = false;
$create_utf8_db = true;
$db_type = 'mysql';

$dbCheckResult = array();

$db_type_status = false; // is there a db type?
$db_server_status = false; // does the db server connection exist?
$db_creation_failed = false; // did we try to create a database and fail?
$db_exist_status = false; // does the database exist?
$db_utf8_support = false; // does the database support utf8?
//Checking for database connection parameters
if ($db_type) {
    $conn = false;
    try {
        $dsn = $db_type . ':host=' . $db_hostname . ';charset=utf8' . ';port=' . $dbconfig['db_port'];
        $conn = new PDO($dsn, $db_username, $db_password);
    } catch (PDOException $e) {
        echo $e->getMessage();
    }
    $db_type_status = true;
    if ($conn) {
        $db_server_status = true; 
        if (stripos($db_type, 'mysql') === 0) {
            $stmt = $conn->query("SHOW VARIABLES LIKE 'version'");
            $res = $stmt->fetch(PDO::FETCH_ASSOC);
            $mysql_server_version = $res['Value']; 
        }
        if ($create_db) {
            // drop the current database if it exists
            $stmt = $conn->query("SHOW DATABASES LIKE '$db_name'");
            if ($stmt->rowCount() != 0) {
                $conn->query("DROP DATABASE `$db_name`");
            }

            // create the new database
            $db_creation_failed = true;

            $query = "CREATE DATABASE " . $db_name;
            if ($create_utf8_db == 'true') {
                if (stripos($db_type, 'mysql') === 0) {
                    $query .= " DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci";
                    $db_utf8_support = true;
                }
                if ($conn->query($query)) {
                    $db_creation_failed = false;
                }
            }
        }

        $stmt = $conn->query("SHOW DATABASES LIKE '$db_name'");
        if ($stmt->rowCount() == 1) {
            $db_exist_status = true;
        }
    }
}
$dbCheckResult['db_utf8_support'] = $db_utf8_support;

$error_msg = '';
$error_msg_info = '';

if (!$db_type_status || !$db_server_status) {
    $error_msg = 'ERR_DATABASE_CONNECTION_FAILED' . '. ' . 'ERR_INVALID_MYSQL_PARAMETERS';
    $error_msg_info = 'MSG_LIST_REASONS' . ':<br>
            -  ' . 'MSG_DB_PARAMETERS_INVALID' . '
            -  ' . 'MSG_DB_USER_NOT_AUTHORIZED';
} elseif ((stripos($db_type, 'mysql') === 0) && $mysql_server_version < 4.1) {
    $error_msg = $mysql_server_version . ' -> ' . 'ERR_INVALID_MYSQL_VERSION';
} elseif ($db_creation_failed) {
    $error_msg = 'ERR_UNABLE_CREATE_DATABASE' . ' ' . $db_name;
    $error_msg_info = 'MSG_DB_ROOT_USER_NOT_AUTHORIZED';
} elseif (!$db_exist_status) {
    $error_msg = $db_name . ' -> ' .'ERR_DB_NOT_FOUND';
} else {
    $dbCheckResult['flag'] = true;
    var_dump($dbCheckResult);
    exit();
}
$dbCheckResult['flag'] = false;
$dbCheckResult['error_msg'] = $error_msg;
$dbCheckResult['error_msg_info'] = $error_msg_info;

var_dump($conn);
var_dump($dbCheckResult);

Thank's playmono =)

There is the output

SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: YES)bool(false) array(4) { ["db_utf8_support"]=> bool(false) ["flag"]=> bool(false) ["error_msg"]=> string(60) "ERR_DATABASE_CONNECTION_FAILED. ERR_INVALID_MYSQL_PARAMETERS" ["error_msg_info"]=> string(104) "MSG_LIST_REASONS:

  • MSG_DB_PARAMETERS_INVALID - MSG_DB_USER_NOT_AUTHORIZED" }

Now try this please:

<?php

$db_type = 'mysql';
$db_hostname = 'localhost';
$db_username = 'root';
$db_password = 'root';
$db_name = 'yetiforce';

try {
    $dsn = $db_type . ':host=' . $db_hostname . ';charset=utf8' . ';port=' . $dbconfig['db_port'];
    $conn = new PDO($dsn, $db_username, $db_password);

    echo 'PDO succesful';
} catch (PDOException $e) {
    echo $e->getMessage();
}

$mysqli = new Mysqli($db_hostname, $db_username, $db_password, $db_name);

var_dump($mysqli);

I replaced the password by my db password

PDO succesfulobject(mysqli)#2 (19) { ["affected_rows"]=> int(0) ["client_info"]=> string(6) "5.5.47" ["client_version"]=> int(50547) ["connect_errno"]=> int(0) ["connect_error"]=> NULL ["errno"]=> int(0) ["error"]=> string(0) "" ["error_list"]=> array(0) { } ["field_count"]=> int(0) ["host_info"]=> string(25) "Localhost via UNIX socket" ["info"]=> NULL ["insert_id"]=> int(0) ["server_info"]=> string(15) "5.5.49-0+deb8u1" ["server_version"]=> int(50549) ["stat"]=> string(133) "Uptime: 6573 Threads: 2 Questions: 117 Slow queries: 0 Opens: 65 Flush tables: 1 Open tables: 58 Queries per second avg: 0.017" ["sqlstate"]=> string(5) "00000" ["protocol_version"]=> int(10) ["thread_id"]=> int(47) ["warning_count"]=> int(0) }

Sorry but I cannot understand why in the first example PDO connection works and in the second example, without any variation, PDO doesnt works.

Sorry I made a mistake, I forgot to replace the password in the first script.

Now there is the result

array(2) { ["db_utf8_support"]=> bool(false) ["flag"]=> bool(true) }

First example is code extracted directly from YetiForce. If you put same credentials, YetiForce install would be fine.

Hi,

Of which file this code is extract?
I try to manually entered my credentials in install/models/Utils.php here
image

And here
image

But I got the same error
image

Thank's for everything =)

Try to install lamp to fresh debian or centos distro, not a turnkey. Add to apache2 only module necessary to start yeti and add to mysql configuration /etc/mysql/my.cnf (on debian) this line:
collation-server = utf8_unicode_ci
init_connect='SET collation_connection = utf8_general_ci'
init_connect='SET NAMES utf8'
character-set-server = utf8
sql_mode=NO_ENGINE_SUBSTITUTION
default-storage-engine = innodb

Okay I created a new virtual machine with debian 8, apache 2.4.10, php 5.6.20 and mysql 5.5.49.

  • I installed those packages = php5-mysql (PDO), php5-gd, php5-imap, php5-curl and php5-ldap.
  • I edited the php.ini like recommanded in the requirements.
  • I added the configuration at the end of my.cnf.
  • After wget and unzip the archive I made a chown -Rvf www:data:www-data and a chmod -Rvf 775 to the yetiforce folder.
  • I rebooted the VM
  • I connected to the web interface and started the configuration with the creation of a new database with my root credentials.

And finally there is no changes..

I created the database "yetiforce" on phpmyadmin with utf8_general_ci and retried to launch the installer, but without result.

I added the configuration at the end of my.cnf.

add under section [mysqld] and restart mysql

with phpmyadmin create user and database with same name and grant all privileges:

yeti1

Nothing more with the the right my.cnf section and the creation of user/database with grant privileges.

I launched the two previous test.php and they succeed both with yetiforce and root.

I also tried to recomment the bind address argument in my.cnf

post result of:

[http://php.net/manual/en/function.phpinfo.php]
only part of module mysqli

post content of file my.cnf
and output from terminal :
apache2ctl -M
apache2ctl -S

and .htaccess in yetifore root folder

There is the phpinfo extract
_deleted_file_

The my.cnf content
image
image
image

And Apache2ctl output
capture

Thank's =)

My VM is hosted by an ESXi 6 with 2vCPU, 3GB of RAM, 1 NetworkCARD (VMX3) and a hard drive of 20GB.
Just in case =)

I'm sorry, but does not see anything wrong, I hope you can help someone.
Try to uncomment bind-address= 127.0.0.1 and try to post /var/log/mysql/error.log

Okay, I uncommented bind-address and restarted mysql.

Content of /var/log/mysql/error.log
image

It's really weird, my password contains special characters maybe It can be the problem?

I don't think, in the data entry phase of the yeti database(first post - second screenshot), uses this settings:
user name = yetiforce
password = pass-mysql-user-yetiforce
database name = yetiforce

Nop no difference... I'm kind of desperate...

Hi.
This problem requires an analysis done by two people – someone who knows YetiForce very well, because it has to be debugged, and someone who knows the server very well, namely an admin.
Solving this problem will most likely take around 30 minutes.
The way you're trying to fix it is a bit impractical and you seem to waste a lot of time on something that should take just a while.

We can help, but we would have to charge for it since it requires logging onto your server and verifying the problem, because what you're doing right now is a bit like guesswork.

Totally agree with @paula-w

Okay, but my company has not planned budget for this project...

How much could you charge for this?

I finally found my problem!

The installer doesn't like special chararcters in the password!

If you post the special character you used, maybe we can improve and fix YetiForce for that case.

Okay I will test it because my password contains a lot of special characters ^^

I think this is the '<' character.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

liberox picture liberox  ·  3Comments

rskrzypczak picture rskrzypczak  ·  3Comments

vovpff picture vovpff  ·  3Comments

serbiaserbia picture serbiaserbia  ·  3Comments

scsikid picture scsikid  ·  3Comments