mysql set default value being given timpstamp '0000-00-00 00:00:00'

Problem: When given set timpstamp mysql default value '0000-00-00 00:00:00':

ERROR 1067 (42000): Invalid default value for 'updateaDate'

Causes and solutions:

SQL-ONLY_FULL_GROUP_BY MODE = #, the STRICT_TRANS_TABLES, the NO_ZERO_IN_DATE, the NO_ZERO_DATE
, the ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION default
to this configuration, this configuration does not allow default value of the date field is '0000-00-00 00:00:00', so changed the following configuration:

sql-mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_
AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

 

Remember After modification, restart the mysql service: /etc/init.d/mysqld restart or service mysqld restart. As the effect of two commands.

 

NOTE: The general configuration sql-mode or in my.ini my.cnf,

Is my.cnf under linux, its path is typically /etc/my.cnf or /etc/mysql/my.cnf or /usr/my.cnf

the win is my.ini, usually in the root directory of the installation directory. 

Guess you like

Origin www.cnblogs.com/mediocreWorld/p/11294412.html