我正在尝试将一个模式从Mysql5.6移动到Mysql5.5。
我将架构从V5.6导出到一个.sql
文件,当尝试将该文件导入到V5.5时,我遇到了一个错误,但我不知道错误是什么,因为sql将所有错误报告为error in sql syntax
。
这是我的create命令,我希望有人能帮助找出错误所在? 错误仅出现在create命令中,因此仅在此处发布相关部分
DROP TABLE IF EXISTS `status_change_logs`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `status_change_logs` (
`entry_id` int(11) NOT NULL AUTO_INCREMENT,
`match_id` int(11) NOT NULL,
`status` smallint(4) NOT NULL,
`timestamp` datetime(4) NOT NULL,
PRIMARY KEY (`entry_id`),
KEY `match_id` (`match_id`)
) ENGINE=InnoDB AUTO_INCREMENT=102273 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
错误
ERROR 1064 (42000) at line 897: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(4) NOT NULL,
PRIMARY KEY (`entry_id`),
KEY `match_id` (`match_id`)
) ENGINE' at line 5
Operation failed with exitcode 1
我相信datetime
类型没有采用括号中的大小,即它应该是
`timestamp` datetime NOT NULL,
而不是
`timestamp` datetime(4) NOT NULL,
至少对于MySQL的旧版本来说是这样。
请尝试以下语法:
`entry_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`match_id` int(11) NOT NULL KEY,