老师这个timestamp为啥到2039年就用不了?
来源:2-28 【讨论题】你会如何配置公司的数据库服务器硬件?

春去_秋来
2022-11-07
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` bigint(0) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp(0) NULL DEFAULT NULL, # 这个timestamp为啥到2039年就用不了?
`updated_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `users_email_unique`(`email`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
写回答
1回答
-
sqlercn
2022-11-08
因为timestamp实例上是用int类型存储的,int的最大值只能到2038年。022022-11-11
相似问题