同步时SQL语法错误1064

时间:2013-03-13 10:55:47

标签: mysql sql

我正在使用MySQL Workbench,我刚在MySQL模型中添加了一个新表。 当我尝试与数据库同步时,我收到以下错误:

Executing SQL script in server
ERROR: Error 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 ') )
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci' at line 5

CREATE  TABLE IF NOT EXISTS `NAW`.`HTML` (
   `ID` INT(11) NOT NULL AUTO_INCREMENT ,
    `HTML` LONGTEXT NULL DEFAULT NULL ,
    PRIMARY KEY (`ID`) ,
    SPATIAL INDEX () 
)   ENGINE = InnoDB
    DEFAULT CHARACTER SET = utf8
    COLLATE = utf8_general_ci

SQL script execution finished: statements: 3 succeeded, 1 failed

如果有人发现错误,那就太棒了!

3 个答案:

答案 0 :(得分:2)

试试这个。

CREATE  TABLE IF NOT EXISTS `NAW`.`HTML` (   
   `ID` INT(11) NOT NULL AUTO_INCREMENT ,
    `HTML` LONGTEXT NULL DEFAULT NULL ,
    PRIMARY KEY (`ID`) ,
    SPATIAL INDEX (`ID`) 
)   ENGINE = MyISAM 
    DEFAULT CHARACTER SET = utf8
    COLLATE = utf8_general_ci

答案 1 :(得分:1)

你现在不能(5.6)使用innoDb引擎使用空间索引,而是使用MyISam引擎。 但是,自5.0.6以来,您可以将空间数据类型与InnoDb一起使用

答案 2 :(得分:0)

您应该从字符设置中删除=符号。

CREATE  TABLE IF NOT EXISTS `NAW`.`HTML` (
  `ID` INT(11) NOT NULL AUTO_INCREMENT,
  `HTML` LONGTEXT NULL DEFAULT NULL,
  PRIMARY KEY (`ID`),
  SPATIAL INDEX ())
ENGINE = MyISAM
DEFAULT CHARACTER SET 'utf8'
COLLATE 'utf8_general_ci'