当前位置:网站首页>导入 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;
边栏推荐
- MySQL34-其他数据库日志
- MySQL combat optimization expert 04 uses the execution process of update statements in the InnoDB storage engine to talk about what binlog is?
- Moteur de stockage mysql23
- API learning of OpenGL (2003) gl_ TEXTURE_ WRAP_ S GL_ TEXTURE_ WRAP_ T
- [after reading the series] how to realize app automation without programming (automatically start Kwai APP)
- Mysql34 other database logs
- [reading notes] rewards efficient and privacy preserving federated deep learning
- A brief introduction to the microservice technology stack, the introduction and use of Eureka and ribbon
- @controller,@service,@repository,@component区别
- MySQL24-索引的数据结构
猜你喜欢

MySQL24-索引的数据结构

Mysql27 - Optimisation des index et des requêtes

Mysql21 - gestion des utilisateurs et des droits

Use JUnit unit test & transaction usage

Security design verification of API interface: ticket, signature, timestamp

API learning of OpenGL (2002) smooth flat of glsl

Not registered via @enableconfigurationproperties, marked (@configurationproperties use)

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

Pytorch LSTM实现流程(可视化版本)

Solve the problem of remote connection to MySQL under Linux in Windows
随机推荐
MySQL29-数据库其它调优策略
Time complexity (see which sentence is executed the most times)
Windchill配置远程Oracle数据库连接
C language string function summary
好博客好资料记录链接
Breadth first search rotten orange
CSDN博文摘要(一) —— 一个简单的初版实现
Security design verification of API interface: ticket, signature, timestamp
在jupyter NoteBook使用Pytorch进行MNIST实现
Use xtrabackup for MySQL database physical backup
Emotional classification of 1.6 million comments on LSTM based on pytoch
Unicode decodeerror: 'UTF-8' codec can't decode byte 0xd0 in position 0 successfully resolved
MySQL combat optimization expert 02 in order to execute SQL statements, do you know what kind of architectural design MySQL uses?
[Julia] exit notes - Serial
Complete web login process through filter
Mysql26 use of performance analysis tools
pytorch的Dataset的使用
MySQL storage engine
MySQL combat optimization expert 09 production experience: how to deploy a monitoring system for a database in a production environment?
[untitled]