Invalid default value for ‘user_invite_date’


Today I tried a dev site setup using a php script installation on my computer.

But got the following error when run the installer – http://myblog.dev/install

ERROR: Unable to execute query

    CREATE TABLE IF NOT EXISTS `users` (
    `user_id` int(11) NOT NULL auto_increment,
    `user_id` int(11) NOT NULL default '0',
    `user_user_id` int(11) default NULL,
    `user_name` varchar(100) NOT NULL,
    `user_type` varchar(255) NOT NULL default 'All',
    `user_invite_date` date NOT NULL default '0000-00-00',
    `user_status` enum('Pending','Confirmed','DENIED') NOT NULL default 'Pending',
    PRIMARY KEY  (`user_id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

Invalid default value for 'user_invite_date'

My mysql version is

    mysql  Ver 14.14 Distrib 5.7.16, for Linux (x86_64) using  EditLine wrapper

The following command I used to find the mysql version

mysql -V 

I googled with sql error and understand that the problem is because of sql_modes.

Error fixed by editing the configuration file in Sublime Text Editor.

subl /etc/mysql/my.cnf

and added the following line into the [mysqld] section:

[mysqld]
sql_mode = "STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

and then restarted MySQL

sudo service mysql restart
Related Posts Plugin for WordPress, Blogger...