0

I can't get past the the Database Selection in the setup script (/setup/setup.php). My setup:

  • Ubuntu 20.04
  • PHP 7.4.9
  • MySQL 8.0.21
  • Ilias 6.1 (also tried 6.2 today, but ran into same issue)

I know the database server and client are working just fine (about a dozen other LAMP applications running on it, and checked the specific ilias connection with mysql on the CLI). But the script keeps coming back to me with:

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

I've tried variations:

  • localhost vs. 127.0.0.1
  • MyISAM vs InnoDB engine

I've added some debugging statements to /Services/Database/classes/PDO/class.ilDBPdo.php and the error code returned is 42000. So've added the following to my.cnf: sql_mode = "IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"

  • and verified that strict mode was indeed disabled.

Here's something interesting: if I delete the $options array from the function call on line 98 of /Services/Database/classes/PDO/class.ilDBPdo.php, then no error code is returned - but the setup script still returns with the error message mentioned above.

Sorry if I'm overlooking something obvious, but any clues would be much appreciated.

Cheers, Onno

Onno
  • 1

1 Answers1

0

I am not sure if my solution is 100% related to yours, however I had a similar issue. Interestingly, there are two errors in the install manual:

  1. The following statement is wrong:

GRANT LOCK TABLES on . TO 'ilias@localhost';

should actually be

GRANT LOCK TABLES on . TO 'ilias'@'localhost';

  1. sql-mode should not include "no_auto_create_user"

sql_mode=IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

should actually be

sql_mode=IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

as NO_AUTO_CREATE_USER is a default for mysql since 5.7. See Make NO_AUTO_CREATE_USER sql_mode behavior the default.

This actually brought me to look into Services/Database/classes/PDO/class.ilDBPdoMySQL.php where I found this line:

$this->pdo->query("SET SESSION sql_mode = 'IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';");

I removed NO_AUTO_CREATE_USER and was able to fully set up ILIAS.