mjnaderi / Sharif-Judge

A free and open source online judge system for programming courses
https://github.com/mjnaderi/Sharif-Judge/tree/docs
GNU General Public License v3.0
384 stars 152 forks source link

Can't create table #69

Open ghost opened 6 years ago

ghost commented 6 years ago

When installing, it popped up an error that it could not create the shj_assignments table\

Sorry for my English

wojcik13 commented 6 years ago

Maybe try connect root user @database server in config (application/config/database.php). If there are some problems, go ahead. Sorry 4 my english.

wwhhoo commented 6 years ago

I have a solution may be can help you

Step 1 Because Blob/text columns can't have a default value in mysql. You can change the setting of mysql vim /etc/my.cnf

Step 2 Change sql-mode=" NO_ENGINE_SUBSTITUTION ,STRICT_TRANS_TABLES " To '#' sql-mode=" NO_ENGINE_SUBSTITUTION ,STRICT_TRANS_TABLES "

Step 3 service mysqld restart

then you could avoid the error of could not create the shj_assignments table but after you enter the web, you would get

The path to folder "assignments" is not set correctly. Move this folder somewhere not publicly accessible, and set its full path in Settings.

The path to folder "tester" is not set correctly. Move this folder somewhere not publicly accessible, and set its full path in Settings.

Step 4

Click the Settings on the left, and change the path of tester and assigments.

Done.

Hope this can help you.

BUU-IT-Informaitcs commented 5 years ago

Disable Strict Sql Mode in Mysql 5.7 or later

  1. To disable strict SQL mode, SSH in to your server as root and create this file:

$ vim /etc/mysql/conf.d/disable_strict_mode.cnf

  1. Open the file and enter these two lines:

[mysqld] sql_mode=IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

  1. Restart MySQL with this command:

$ sudo service mysql restart