Mysql错误类型#1067 - 无效时的默认值

时间:2016-02-11 08:48:27

标签: mysql phpmyadmin mysql-workbench

当我从Mysql Workbench6.3导出我的表并使用Phpmyadmin插入我的数据库时出现了更多错误。

   CREATE TABLE IF NOT EXISTS `loan`.`tb_banks` (
  `id` INT(10) NOT NULL AUTO_INCREMENT,
  `bank_name` VARCHAR(100) CHARACTER SET 'utf8' NOT NULL,
  `account_name` VARCHAR(100) CHARACTER SET 'utf8' NOT NULL,
  `account_number` VARCHAR(100) CHARACTER SET 'utf8' NOT NULL,
  `active` TINYINT(4) NOT NULL DEFAULT '1',
  `user_id` INT(11) NOT NULL,
  `created_at` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated_at` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  CONSTRAINT `banks.user_id = users.id`
    FOREIGN KEY (`user_id`)
    REFERENCES `loan`.`tb_users` (`id`)
    ON DELETE CASCADE
    ON UPDATE CASCADE)
ENGINE = InnoDB
AUTO_INCREMENT = 31
DEFAULT CHARACTER SET = utf8;

SHOW WARNINGS;
CREATE INDEX `banks_user_id_index` ON `loan`.`tb_banks` (`user_id` ASC);

SHOW WARNINGS;

这是我的错误 enter image description here

1 个答案:

答案 0 :(得分:1)

MySQL不接受在日期或月份列中包含零的TIMESTAMP值或不是有效日期的值。 TIMESTAMP 数据类型用于包含日期和时间部分的值。 TIMESTAMP的范围为'1970-01-01 00:00:01'UTC到'2038-01-19 03:14:07'UTC。

有关此内容的更多信息:http://dev.mysql.com/doc/refman/5.7/en/datetime.html