当前位置:网站首页>导入 SQL 时出现 Invalid default value for ‘create_time‘ 报错解决方法
导入 SQL 时出现 Invalid default value for ‘create_time‘ 报错解决方法
2022-07-06 09:12:00 【程序员柒七】
方案一
重装 MySQL 数据库,版本选择 5.7 或者 5.7 以上版本,这个方案有些粗暴,不喜欢粗暴的朋友可以继续往下看。
方案二
这个错误的主要原因,是因为给了时间字段的列默认值一个 CURRENT_TIMESTAMP 默认值,而这个默认值在低版本的 MySQL 中是不支持的,因此就出现了题目中的这个报错,所以呢,把每个时间字段的默认值修改一下即可,比如:
DROP TABLE IF EXISTS `tb_config`;
CREATE TABLE `tb_config` (
`config_name` varchar(100) NOT NULL DEFAULT '' COMMENT '配置项的名称',
`config_value` varchar(200) NOT NULL DEFAULT '' COMMENT '配置项的值',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`config_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
改为
DROP TABLE IF EXISTS `tb_config`;
CREATE TABLE `tb_config` (
`config_name` varchar(100) NOT NULL DEFAULT '' COMMENT '配置项的名称',
`config_value` varchar(200) NOT NULL DEFAULT '' COMMENT '配置项的值',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`config_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
边栏推荐
- Mysql33 multi version concurrency control
- 评估方法的优缺点
- MySQL32-锁
- Software test engineer development planning route
- February 13, 2022 - Maximum subarray and
- Const decorated member function problem
- Pytorch RNN actual combat case_ MNIST handwriting font recognition
- MySQL transaction log
- MySQL combat optimization expert 05 production experience: how to plan the database machine configuration in the real production environment?
- Use xtrabackup for MySQL database physical backup
猜你喜欢

Export virtual machines from esxi 6.7 using OVF tool

MySQL22-逻辑架构

Adaptive Bezier curve network for real-time end-to-end text recognition

Ueeditor internationalization configuration, supporting Chinese and English switching

A brief introduction to the microservice technology stack, the introduction and use of Eureka and ribbon

MySQL26-性能分析工具的使用

UEditor国际化配置,支持中英文切换

Bytetrack: multi object tracking by associating every detection box paper reading notes ()
![[reading notes] rewards efficient and privacy preserving federated deep learning](/img/c3/5e88277b5024885d5ceeaa0de14b27.jpg)
[reading notes] rewards efficient and privacy preserving federated deep learning

MySQL31-MySQL事务日志
随机推荐
CSDN问答标签技能树(二) —— 效果优化
The underlying logical architecture of MySQL
Chrome浏览器端跨域不能访问问题处理办法
Global and Chinese markets for aprotic solvents 2022-2028: Research Report on technology, participants, trends, market size and share
API learning of OpenGL (2001) gltexgen
MySQL combat optimization expert 05 production experience: how to plan the database machine configuration in the real production environment?
MySQL24-索引的数据结构
实现以form-data参数发送post请求
Not registered via @enableconfigurationproperties, marked (@configurationproperties use)
Mysql21 user and permission management
Windchill配置远程Oracle数据库连接
Use JUnit unit test & transaction usage
Water and rain condition monitoring reservoir water and rain condition online monitoring
API learning of OpenGL (2002) smooth flat of glsl
In fact, the implementation of current limiting is not complicated
MySQL combat optimization expert 02 in order to execute SQL statements, do you know what kind of architectural design MySQL uses?
A brief introduction to the microservice technology stack, the introduction and use of Eureka and ribbon
Mysql34 other database logs
[paper reading notes] - cryptographic analysis of short RSA secret exponents
text 文本数据增强方法 data argumentation