1

As title, I tried to install ilias on ubuntu 16.

When I create new client,the database name block appear a error:

"Database can't be reached. Please check the credentials and if database exists-" about the error

I tried to reinstall the MySQL,and the installed details shown that:

"Determining localhost credentials from /etc/mysql/debian.cnf: succeeded."

So I thought that the problem about credentials has no error.

But now I'm so confused that how show I do to solve the error.

What should I do?

Xyanophat
  • 11
  • 4
  • Are you still struggling with this? If yes, have you tried to connect to the DB by command line from your server running ILIAS? E.g. see https://www.cyberciti.biz/faq/how-to-connect-to-my-mysql-database-server-using-command-line-and-php/ If this succeeds, then your parameters seem fine and we have to look further to find the error. – Amstutz May 29 '17 at 09:19
  • I also had this issue. I guess there are some problems with the procedures of installing php, mysql, and apache. Instead, you could workaround that by installing xampp with comes prebuilt with all the necessary applications. That should fix the connection with the database and php. – TheSoldier Jul 26 '17 at 09:09

2 Answers2

0

Not sure if you are still working on this issue, but there are two steps that you could perform.

Step 1: Make sure your system is properly configured. Check if you can connect to your local db by performing:

mysql -u username -p -h yourHost (yourHost is probably localhost)

If you can not connect, you should check some mysql tutorial on how to set up and connect to the database. If you can connect, make sure you have a correct client.ini.php (located in ilias/data/iliasClient) file, should look like this :

[db] <-- This is the section you need to look at
type = "innodb"
host = "yourHost"
user = "user"
pass = "password"
name = "db_name"
structure_reload = "0"

(You might also read up on the following thread: https://www.ilias.de/docu/goto_docu_frm_1875_4446.html)

If this still does not work, you should go to step 2.

Step 2: For custom ports or other non-default configuration

In the following thread there is an issue discussing connections to the db using non-standard ports: https://www.ilias.de/docu/goto_docu_frm_1875_4488.html. Unfortunately in german.

The short version of the solution for this is, that there seems to be an issue connecting to mysql using other than non-default ports. Check the linked thread for the patch file if you are using not a recent version or ILIAS or update to the latest version in git which should solve the issue.

Amstutz
  • 565
  • 3
  • 14
0

I recently experienced the same issue. After investigating, I found that the file Database/classes/PDO/class.ilDBPdoMySQL.php at line 33, function initSqlMode(), contained an invalid value inside the query: NO_AUTO_CREATE_USER.

I removed that value, and it worked.

The final piece of code should look like this:

protected function initSQLMode()
{
    $this->pdo->query("SET SESSION sql_mode = 'IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';");
}

(Tested on ILIAS 5.4)

Kalamun
  • 429
  • 4
  • 10