mysql 5.7版本后时间datetime 默认为 0000-00-00 00:00:00 问题

 

CREATE TABLE `test_user` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` char(25) DEFAULT '' COMMENT '用户名',
`pw` char(32) DEFAULT '' COMMENT '密码',
`phone_num` int(11) unsigned DEFAULT NULL COMMENT '手机号',
`sex` tinyint(2) unsigned DEFAULT '1' COMMENT '性别 1男 2女',
`type` tinyint(2) unsigned DEFAULT '1' COMMENT '会员级别 1 普通 2 青铜 3 白银 4 黄金',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`),
UNIQUE KEY `phone_num` (`phone_num`),
KEY `phone_pw` (`phone_num`,`pw`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='用户表';

 

 

posted on 2019-04-17 20:39  totau  阅读(2078)  评论(0编辑  收藏  举报

导航