This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

swaraj.dhumne9458
swaraj.dhumne9458

I am trying to install octobercms, and I get to the point where I can choose blank template, or theme, or something else. After that, I get an error that reads as such:

[2015/07/16 01:49:18] Install step: createAdmin [2015/07/16 01:49:18] Handler error (onInstallStep): SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'created_at' (SQL: create table deferred_bindings (id int unsigned not null auto_increment primary key, master_type varchar(255) not null, master_field varchar(255) not null, slave_type varchar(255) not null, slave_id varchar(255) not null, session_key varchar(255) not null, is_bind tinyint(1) not null default '1', created_at timestamp default 0 not null, updated_at timestamp default 0 not null) default character set utf8 collate utf8_unicode_ci engine = InnoDB)

I followed the instructions given and have disabled NO_ZERO_DATE, however the problem still occurs. Is there another way to avoid this error?

FelixINX
FelixINX

What is your;

  • MySQL version,
  • PHP version,
  • and your OS
Kerber
Kerber

same error

MySQL version 5.7.9

PHP version 5.6.15

OS Win 10 Ent

Last updated

gavinfostered11132
gavinfostered11132

This is an issue with laravel and zero timestamps with mysql version 5.7.x using strict mode. Not really an OctoberCMS issue, although they could start to add valid time stamps on the column when data is being inserted to resolve.

Taylor Otwell commented on this issue a few days ago saying "There is no "permanent" fix other than either turning off strict mode or putting a valid time stamp on the column when you insert it." You can view the laravel github issue here: https://github.com/laravel/framework/issues/3602

I resolved it by turning off sql strict mode. My setup is Ubuntu using MySQL 5.7.9

  • Go to /etc/mysql/conf.d and create a new .cnf file as root. These settings will override any settings in the my.cnf file so you don't have to change the my.cnf directly. I called mine my5.7.cnf:

$ cd /etc/mysql/conf.d

$ sudo touch my5.7.cnf

  • Edit the file and add the following link to turn off strict mode by setting sql_mode to an empty string:

$ sudo vi my5.7.cnf

Add these lines to the top of the file, save and quit

[mysqld]
sql_mode=''

Alternatively you can just omit NO_ZERO_IN_DATE, NO_ZERO_DATE from the default sql mode that ships with mysql 5.7.x

[mysqld]
sql_mode="ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
  • Restart the mysql server

$ sudo /etc/init.d/mysql restart

Start the installation again and you should be good to go.

Last updated

Kerber
Kerber

gavinfostered11132 said:

This is an issue with laravel and zero timestamps with mysql version 5.7.x using strict mode. Not really an OctoberCMS issue, although they could start to add valid time stamps on the column when data is being inserted to resolve.

Taylor Otwell commented on this issue a few days ago saying "There is no "permanent" fix other than either turning off strict mode or putting a valid time stamp on the column when you insert it." You can view the laravel github issue here: https://github.com/laravel/framework/issues/3602

I resolved it by turning off sql strict mode. My setup is Ubuntu using MySQL 5.7.9

  • Go to /etc/mysql/conf.d and create a new .cnf file as root. These settings will override any settings in the my.cnf file so you don't have to change the my.cnf directly. I called mine my5.7.cnf:

$ cd /etc/mysql/conf.d

$ sudo touch my5.7.cnf

  • Edit the file and add the following link to turn off strict mode by setting sql_mode to an empty string:

$ sudo vi my5.7.cnf

Add these lines to the top of the file, save and quit

[mysqld]
sql_mode=''

Alternatively you can just omit NO_ZERO_IN_DATE, NO_ZERO_DATE from the default sql mode that ships with mysql 5.7.x

[mysqld]
sql_mode="ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
  • Restart the mysql server

$ sudo /etc/init.d/mysql restart

Start the installation again and you should be good to go.

Thank you so much

justincck
justincck

As newly noted in the github issue you linked to, an easy answer is to open /config/database.php and add 'strict' => true in your mysql connection array.

Mine looks like this (and it fixed the error):

'mysql' => [
        'driver'    => 'mysql',
        'host'      => env('DB_HOST'),
        'port'      => env('DB_PORT'),
        'database'  => env('DB_DATABASE'),
        'username'  => env('DB_USERNAME'),
        'password'  => env('DB_PASSWORD'),
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix'    => '',
        'strict' => true
],

Last updated

pendarsys27737
pendarsys27737

if you faced with sql_mode error , you only need to add 'strict' => false to database config file and mysql array like this :

'mysql' => [ ... 'strict' => false ];

Thanks to justincck .

1-7 of 7

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.