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='用户表';

猜你喜欢

转载自www.cnblogs.com/qutao125/p/10726034.html
今日推荐