Invalid default value for 'create_date' timestamp field

后端 未结 16 1597
我寻月下人不归
我寻月下人不归 2020-11-30 16:49

I have the following sql create statement

mysql> CREATE  TABLE IF NOT EXISTS `erp`.`je_menus` (
    ->   `id` INT(11) NOT NULL AUTO_INCREMENT ,
    -&g         


        
16条回答
  •  难免孤独
    2020-11-30 17:10

    In ubuntu desktop 16.04, I did this:

    1. open file: /etc/mysql/mysql.conf.d/mysqld.cnf in an editor of your choice.

    2. Look for: sql_mode, it will be somewhere under [mysqld].

    3. and set sql_mode to the following:

      NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

    4. Save and then restart mysql service by doing:

      sudo service mysql restart

提交回复
热议问题