今天,我将别人发给我的整个表的sql导出数据库中,却报错了:
There was error(s) while executing the queries .
The query and the error message has been logged at:
C:\Users\杰\AppData\Roaming\SQLyog\sqlyog.err.
Please click on "Open Error File..." to open the error file.
这里大概意思是:
在执行查询时发现一个错误,查询过程和错误信息被记录在:C:\C:\Users\Administrator\AppData\Roaming\SQLyog\sqlyog.err.
于是我只好打开这个文件,发现里面报的是:
Query:
CREATE TABLE `user` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Account` varchar(30) DEFAULT NULL,
`Password` varchar(30) DEFAULT NULL,
`Status` int(11) DEFAULT NULL,
`EmployeeId` int(11) DEFAULT NULL,
`LatestLogin` datetime DEFAULT NULL,
`UserName` varchar(50) DEFAULT NULL,
`roleIdList` varchar(400) DEFAULT NULL,
`roleNameList` varchar(800) DEFAULT NULL,
`isolatedareaNo` varchar(255) DEFAULT NULL,
`isteamer` int(11) DEFAULT NULL,
`passArea` varchar(255) DEFAULT NULL,
`remark` varchar(255) DEFAULT NULL,
`validateDate` datetime DEFAULT NULL,
`headImgPath` varchar(255) DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `FK_EmployeeId` (`EmployeeId`) USING BTREE,
KEY `FK36EBCBFFF5E7D0` (`EmployeeId`) USING BTREE,
CONSTRAINT `user_ibfk_1` FOREIGN KEY (`EmployeeId`) REFERENCES `employee` (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=66 DEFAULT CHARSET=utf8
Error occured at:2015-10-13 23:11:28
Line no.:2048
Error Code: 1064 - 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 'USING BTREE,
KEY `FK36EBCBFFF5E7D0` (`EmployeeId`) USING BTREE,
CONSTRAINT `' at line 18
查了一下资料,才知道mysql版本的问题,mysql5.0和mysql5.1在处理到索引语句时有所区别。
解决方法:
KEY `FK36EBCBFFF5E7D0` (`EmployeeId`) USING BTREE
修改为:
KEY `FK36EBCBFFF5E7D0` USING BTREE (`EmployeeId`)
这样就可以完美解决了!