MySQL timestamp setting default value error Invalid default value reason and solution
The data exported from the mysql5.5 database is placed in mysql5.7.10 and an error is reported!
DROP TABLE IF EXISTS `passwd_reset`;
CREATE TABLE `passwd_reset` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`staffId` int(11) DEFAULT NULL,
`toEmail` varchar(50) DEFAULT NULL,
`token` varchar(100) DEFAULT NULL,
`validTime` int(11) DEFAULT NULL,
`createTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`updateTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=gbk;
error
:
[SQL] DROP TABLE IF EXISTSÂ
passwd_reset
; Affected rows: 0 Time: 0.000s [Err] 1067-Invalid default value for’createTime’
reason
:
The value range of timestamp type: 1970-01-01 00:00:00 to 2037-12-31 23:59:59,
Adjust the initial value to 1970-01-02 00:00:00 and it’s fine. For the time being, I don’t know how to get it into the 5.5 database.
Similar Posts:
- mysql: [Err] 1075 – Incorrect table definition; there can be only one auto column and it must be d…
- When mysql creates a table, set timestamp DEFAULT NULL error 1067-Invalid default value for’updated_at’
- [Solved] MySQL query reports an error: Legal mix of settlements
- MYSQL ERROR 1005 (HY000): Can’t create table [How to Solve]
- In Oracle, an error is reported: ora-00904
- Failed to read auto-increment value from storage
- Database upgrade from Zabbix 5.0.15 to Zabbix 5.2.7 failed
- SET SQL_MODE=”NO_AUTO_VALUE_ON_ZERO”
- [Solved] MySQL ERROR 1062 (23000): Duplicate entry ‘0’ for key ‘PRIMARY’
- [Solved] MySQL uses the workbench tool, and the table status is read only