我使用 dbForge (v6) 导出了一个数据库,整个脚本都有这个问题:
USE `global-cms-content2`;
CREATE TABLE `global-cms-content2`.umbracorelationtype (
ID int(11) NOT NULL AUTO_INCREMENT,
DUAL bit(1) NOT NULL,
PARENTOBJECTTYPE char(36) NOT NULL,
CHILDOBJECTTYPE char(36) NOT NULL,
NAME varchar(255) NOT NULL,
ALIAS varchar(100) DEFAULT NULL,
PRIMARY KEY (ID)
)
ENGINE = INNODB
AUTO_INCREMENT = 2
AVG_ROW_LENGTH = 16384
CHARACTER SET utf8
COLLATE utf8_general_ci;
错误是:
1 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 'DUAL bit(1) NOT NULL,
PARENTOBJECTTYPE char(36) NOT NULL,
CHILDOBJECTTYPE ' at line 3 SQL2.sql 2 1
即使我使用编辑器手动创建表,也会发生同样的错误。
为什么 MySQL 不能使用自己的脚本?有任何想法吗?
更新:
这做到了!
USE `global-cms-content3`;
CREATE TABLE `global-cms-content3`.umbracorelationtype (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`DUAL` bit(1) NOT NULL,
`PARENTOBJECTTYPE` char(36) NOT NULL,
`CHILDOBJECTTYPE` char(36) NOT NULL,
`NAME` varchar(255) NOT NULL,
`ALIAS` varchar(100) DEFAULT NULL,
PRIMARY KEY (ID)
)
ENGINE = INNODB
AUTO_INCREMENT = 2
AVG_ROW_LENGTH = 16384
CHARACTER SET utf8
COLLATE utf8_general_ci;
仍然不确定为什么导出脚本或备份数据库脚本不处理保留关键字......无论如何