During domjudge 5.1.2 setup on Ubuntu 16.04 with MySQL 5.7.13, PHP 7, Apache 2.4.18 I am getting the following error after executing:
sudo /opt/domjudge/domserver/bin/dj-setup-database -u root -r install
Database credentials read from '/opt/domjudge/domserver/etc/dbpasswords.secret'. Enter password: DOMjudge database and user(s) created. Enter password: ERROR 1292 (22007) at line 744: Truncated incorrect datetime value: '2016-01-01 08:00:00 UTC'
There is no line 744 in dj-setup-database. Searching for ERROR 1292 (22007) does not bring me any closer to a solution.
I continued with the installation and everything seems to work OK. There are no example contests, users, teams, problems when I do so.
Running:
sudo /opt/domjudge/domserver/bin/dj-setup-database -u root -r status
indicates that the database check was successful.
Any hints here?
Thanks,
Malcolm Corney
On 03-08-16 23:35, Malcolm Corney wrote:
During domjudge 5.1.2 setup on Ubuntu 16.04 with MySQL 5.7.13, PHP 7, Apache 2.4.18 I am getting the following error after executing:
sudo /opt/domjudge/domserver/bin/dj-setup-database -u root -r install
Database credentials read from '/opt/domjudge/domserver/etc/dbpasswords.secret'. Enter password: DOMjudge database and user(s) created. Enter password: ERROR 1292 (22007) at line 744: Truncated incorrect datetime value: '2016-01-01 08:00:00 UTC'
There is no line 744 in dj-setup-database. Searching for ERROR 1292 (22007) does not bring me any closer to a solution.
I continued with the installation and everything seems to work OK. There are no example contests, users, teams, problems when I do so.
Ok, this error message is a little misleading. The dj-setup-database script pipes SQL files into the MySQL database on lines 234-237, and it seems that there was an issue with the file mysql_db_examples.sql.
Here I have:
$ wc -l mysql_db_* 143 mysql_db_defaultdata.sql 90 mysql_db_examples.sql 26 mysql_db_files_defaultdata.sql 8 mysql_db_files_examples.sql 562 mysql_db_structure.sql 829 total
so there are 562+143+26 = 731 lines inserted before mysql_db_examples.sql, so the error should be on line 13 of that file.
That contains an INSERT query for contests and it seems to fail on the UNIX_TIMESTAMP() conversion of time strings. According to the MySQL documentation this cannot contain a timezone and will be interpreted in the system's local timezone.
Running:
sudo /opt/domjudge/domserver/bin/dj-setup-database -u root -r status
indicates that the database check was successful.
Any hints here?
Ok, so only the example data failed to be added to the database. If you can live with that, then no problem.
The fix is to remove the timezone from the string and encode the time in the system's timezone. The easiest (for us) is probably to set the timezone to UTC for the current SQL connection.
Jaap